#include "hrvdataprocess.h"
#include "qjsonarray.h"
#include "qjsonobject.h"
#include "qmath.h"
#include <windows.h>
#include "FFTAlg.h"
#include "listoperation.h"
#include "qjsondocument.h"

HRVDataProcess::HRVDataProcess()
{

    f = new double[256];
    dst = new double[256];
    appgalg=new AppgAlg();
    InitHrvParameter();
}
HRVDataProcess::~HRVDataProcess()
{
    delete[]f;
    delete[]dst;
    delete appgalg;
}
void HRVDataProcess::setAge(int age,int gender)
{
    this->age=age;
    this->gender=gender;
}
void HRVDataProcess::InitHrvParameter(void)
{
    int v8 = 0;
    int result;
    double v1,v2,v3,v4,v5,v6,v7,v9, v10, v11, v12, v13, v17, v19, v20,v21;
    double var_18, var_8, var_10;
    double v35, v36, v37,v43, v14, v15;
    double v34[2];
    double v48, v38, v44, v40, v42, v46, v39, v41, v45, v47;
    int v18 = 0;

    v1 = 69.1;         //  69.09999999999999
    v2 = 0;
    v3 = 0;
    v48 = 0;
    v4 = 0;
    v38 = 0.0;
    v5 = 0;
    v44 = 0.0;
    v40 = 0.0;
    v6 = 69.4;         //  69.40000000000001
    v42 = 0.0;
    v8 = 0;
    v46 = 0.0;
    v39 = 0.0;
    v41 = 0.0;
    v45 = 0;
    v34[1] = 0;
    v34[0] = 0;
    v9 = 68.7;         // 68.7
    v43 = 0;
    v36 = 0;
    v37 = 0;
    v35 = 0;
    v47 = 0;

    do
    {
        if (v8)
        {
            if (v8 == 1)
            {
                var_8 = 0;
                var_18 = 3.54;
                v2 = 92;   // 92
                v3 = 94;   // 94
                v48 = 0.378;            // 0.378
                v38 = 7.41;
                v44 = 7.32;
                v40 = 6.52;
                v42 = 6.13;
                v46 = 6.34;
                v39 = 6.22;
                v41 = 6.23;
                v10 = 6.045;            // 6.045
                goto LABEL_4;
            }

            if (v8 == 2)
            {
                var_18 = 3.57;
                var_8 = 0.095;
                v2 = 91;   // 91
                v3 = 93.5;   // 93.5
                v11 = 3.59;            // 3.59
                v12 = 47.2;            // 47.2
                v48 = 0.412;            // 0.411
                v38 = 7.42;
                v44 = 7.32;
                v40 = 6.51;
                v42 = 6.14;
                v46 = 6.36;
                v39 = 6.21;
                v41 = 6.2;
                v10 = 6.03;            // 6.03
                goto LABEL_5;
            }
            if (v8 == 3)
            {
                var_18 = 3.6;
                var_8 = 0.231;
                v2 = 90.0;
                v3 = 93.0;
                v11 = 3.59;
                v12 = 47.5;
                v48 = 0.445;
                v38 = 7.42;
                v44 = 7.32;
                v40 = 6.5;
                v42 = 6.14;
                v46 = 6.37;
                v39 = 6.2;
                v41 = 6.17;
                v10 = 6.01;
                goto LABEL_5;
            }
            if (v8 == 4)
            {
                var_18 = 3.62;
                var_8 = 0.344;
                v48 = 0.476;
                v38 = 7.43;
                v2 = 89.0;
                v3 = 92.0;
                v4 = 53.9;
                v5 = 48.7;
                v11 = 3.6;
                v44 = 7.31;
                v40 = 6.49;
                v42 = 6.15;
                v46 = 6.38;
                v39 = 6.18;
                v41 = 6.14;
                v45 = 5.99;
                v34[1] = 47.8;
                v43 = 89.0;
                v34[0] = 47.7;
                goto LABEL_164;
            }
            if (v8 == 5)
            {
                var_18 = 3.64;
                var_8 = 0.438;
                v48 = 0.507;
                v2 = 88.0;
                v3 = 91.0;
                v4 = 53.7;
                v5 = 48.5;
                v11 = 3.61;
                v38 = 7.43;
                v44 = 7.3;
                v40 = 6.48;
                v42 = 6.15;
                v46 = 6.39;
                v39 = 6.17;
                v41 = 6.1;
                v45 = 5.98;
                v13 = 49.1;
            LABEL_16:
                v34[1] = v13;
                v34[0] = 49.9;
            LABEL_163:
                v43 = v2;
                goto LABEL_164;
            }
            if (v8 == 6)
            {
                var_18 = 3.66;
                var_8 = 0.519;
                v48 = 0.536;
                v38 = 7.43;
                v2 = 86.0;
                v3 = 90.0;
                v4 = 53.5;
                v5 = 48.3;
                v11 = 3.61;
                v44 = 7.3;
                v40 = 6.46;
                v42 = 6.15;
                v46 = 6.39;
                v39 = 6.15;
                v41 = 6.07;
                v45 = 5.95;
                v34[1] = 51.4;
                v43 = 86.0;
                v34[0] = 52.9;
                goto LABEL_164;
            }
            if (v8 == 7)
            {
                var_18 = 3.67;
                var_8 = 0.593;
                v48 = 0.565;
                v38 = 7.43;
                v2 = 84.0;
                v3 = 89.1;
                v4 = 53.2;
                v5 = 48.1;
                v11 = 3.62;
                v44 = 7.29;
                v40 = 6.45;
                v42 = 6.15;
                v46 = 6.39;
                v39 = 6.13;
                v41 = 6.04;
                v45 = 5.93;
                v34[1] = 54.3;
                v43 = 84.0;
                v34[0] = 55.9;
                goto LABEL_164;
            }
            if (v8 == 8)
            {
                var_18 = 3.68;
                var_8 = 0.652;
                v48 = 0.593;
                v38 = 7.42;
                v2 = 82.0;
                v3 = 87.4;
                v4 = 52.9;
                v5 = 47.9;
                v11 = 3.62;
                v44 = 7.27;
                v40 = 6.44;
                v42 = 6.14;
                v46 = 6.39;
                v39 = 6.11;
                v41 = 6.0;
                v45 = 5.91;
                v34[1] = 57.5;
                v43 = 82.0;
                v34[0] = 58.3;
                goto LABEL_164;
            }
            if (v8 == 9)
            {
                var_18 = 3.7;
                var_8 = 0.713;
                v48 = 0.61;
                v2 = 80.2;
                v3 = 85.6;
                v4 = 52.5;
                v5 = 47.6;
                v38 = 7.41;
                v44 = 7.26;
                v40 = 6.42;
                v42 = 6.14;
                v46 = 6.39;
                v39 = 6.08;
                v41 = 5.97;
                v45 = 5.89;
                v14 = 59.6;
            LABEL_25:
                v11 = 3.63;
                v34[1] = v14;
                v34[0] = 59.6;
                goto LABEL_163;
            }
            if (v8 == 10)
            {
                var_18 = 3.71;
                var_8 = 0.761;
                v48 = 0.61;
                v2 = 78.4;
                v3 = 83.8;
                v4 = 52.1;
                v5 = 47.3;
                v38 = 7.41;
                v44 = 7.25;
                v40 = 6.4;
                v42 = 6.14;
                v46 = 6.38;
                v39 = 6.06;
                v41 = 5.93;
                v45 = 5.86;
                v14 = 63.2;
                goto LABEL_25;
            }
            if (v8 == 11)
            {
                var_18 = 3.72;
                var_8 = 0.806;
                v48 = 0.61;                       //  0.61
                v38 = 7.4;
                v2 = 77.3;     //  77.3
                v3 = 81.9;
                v4 = 51.7;
                v5 = 47;
                v11 = 3.64;
                v44 = 7.23;
                v40 = 6.39;
                v42 = 6.13;
                v46 = 6.37;
                v39 = 6.03;
                v41 = 5.89;
                v45 = 5.84;
                v34[1] = 64.9;
                v34[0] = 58.6;
                goto LABEL_163;
            }
            if (v8 == 12)
            {
                var_18 = 3.73;
                var_8 = 0.846;
                v48 = 0.604;
                v38 = 7.38;
                v2 = 76.3;
                v3 = 79.1;
                v4 = 51.2;
                v5 = 46.6;
                v11 = 3.64;
                v44 = 7.22;
                v40 = 6.37;
                v42 = 6.12;
                v46 = 6.35;
                v39 = 6.01;
                v41 = 5.86;
                v45 = 5.81;
                v34[1] = 65.5;
                v34[0] = 56.6;
                goto LABEL_163;
            }
            if (v8 == 13)
            {
                var_18 = 3.74;
                var_8 = 0.884;
                v48 = 0.593;
                v38 = 7.37;
                v2 = 75.5;
                v3 = 77.1;
                v4 = 50.7;
                v5 = 46.2;
                v11 = 3.65;
                v44 = 7.2;
                v40 = 6.35;
                v42 = 6.12;
                v46 = 6.33;
                v39 = 5.98;
                v41 = 5.82;
                v45 = 5.79;
                v34[1] = 64.4;
                v34[0] = 54.4;
                goto LABEL_163;
            }
            if (v8 == 14)
            {
                var_18 = 3.75;
                var_8 = 0.916;
                v48 = 0.582;
                v38 = 7.35;
                v2 = 74.7;
                v3 = 76.6;
                v4 = 50.1;
                v5 = 45.8;
                v11 = 3.65;
                v44 = 7.18;
                v40 = 6.33;
                v42 = 6.11;
                v46 = 6.31;
                v39 = 5.95;
                v41 = 5.78;
                v45 = 5.76;
                v34[1] = 61.4;
                v34[0] = 52.7;
                goto LABEL_163;
            }
            if (v8 == 15)
            {
                var_18 = 3.76;
                var_8 = 0.944;
                v48 = 0.577;
                v38 = 7.34;
                v2 = 74.1;
                v3 = 75.4;
                v4 = 49.5;
                v5 = 45.4;
                v11 = 3.66;
                v44 = 7.16;
                v40 = 6.31;
                v42 = 6.1;
                v46 = 6.29;
                v39 = 5.92;
                v41 = 5.74;
                v45 = 5.73;
                v34[1] = 62.2;
                v34[0] = 52.5;
                goto LABEL_163;
            }
            if (v8 == 16)
            {
                var_18 = 3.77;
                var_8 = 0.971;
                v48 = 0.577;
                v2 = 73.6;
                v3 = 75.2;
                v4 = 48.9;
                v5 = 45;
                v11 = 3.66;
                v38 = 7.32;
                v44 = 7.14;
                v40 = 6.29;
                v42 = 6.09;
                v46 = 6.27;
                v39 = 5.88;
                v41 = 5.7;
                v45 = 5.7;
                v34[1] = 62.7;
                v43 = 73.6;
                v34[0] = 53.0;
                goto LABEL_164;
            }
            if (v8 == 17)
            {
                var_18 = 3.78;
                var_8 = 0.993;
                v48 = 0.582;
                v38 = 7.3;
                v2 = 73.1;
                v3 = 75.1;
                v4 = 48.3;
                v5 = 44.5;
                v11 = 3.67;
                v44 = 7.12;
                v40 = 6.27;
                v42 = 6.08;
                v46 = 6.24;
                v39 = 5.85;
                v41 = 5.65;
                v45 = 5.67;
                v34[1] = 63.3;
                v34[0] = 53.5;
                goto LABEL_163;
            }
            if (v8 == 18)
            {
                var_18 = 3.79;
                var_8 = 1.012;//
                v48 = 0.599;
                v38 = 7.27;
                v2 = 72.8;
                v3 = 75;
                v4 = 47.7;
                v5 = 44;
                v11 = 3.67;
                v44 = 7.1;
                v40 = 6.25;
                v42 = 6.06;
                v46 = 6.21;
                v39 = 5.82;
                v41 = 5.61;
                v45 = 5.64;
                v34[1] = 63.8;
                v34[0] = 53.9;
                goto LABEL_163;
            }
            if (v8 == 19)
            {
                var_18 = 3.8;
                var_8 = 1.03;
                v48 = 0.61;
                v38 = 7.25;
                v2 = 72.5;
                v3 = 74.9;
                v4 = 47;
                v5 = 43.6;
                v11 = 3.68;
                v44 = 7.07;
                v40 = 6.23;
                v42 = 6.05;
                v46 = 6.18;
                v39 = 5.78;
                v41 = 5.57;
                v45 = 5.61;
                v34[1] = 64.1;
                v34[0] = 54.2;
                goto LABEL_163;
            }
            if (v8 == 20)
            {
                var_18 = 3.81;
                var_8 = 1.047;
                v48 = 0.621;
                v38 = 7.22;
                v2 = 72.3;
                v3 = 74.8;
                v4 = 46.3;
                v5 = 43;
                v11 = 3.68;
                v44 = 7.05;
                v40 = 6.21;
                v42 = 6.04;
                v46 = 6.15;
                v39 = 5.75;
                v41 = 5.53;
                v45 = 5.58;
                v34[1] = 64.3;
                v34[0] = 54.4;
                goto LABEL_163;
            }
            if (v8 == 21)
            {
                var_18 = 3.83;
                var_8 = 1.061;
                v48 = 0.637;
                v38 = 7.2;
                v2 = 72.1;
                v3 = 74.7;
                v4 = 45.6;
                v5 = 42.5;
                v11 = 3.69;
                v44 = 7.02;
                v40 = 6.19;
                v42 = 6.02;
                v46 = 6.12;
                v39 = 5.71;
                v41 = 5.49;
                v45 = 5.54;
                v34[1] = 64.6;
                v34[0] = 54.5;
                goto LABEL_163;
            }
            if (v8 == 22)
            {
                var_18 = 3.84;
                var_8 = 1.072; //
                v48 = 0.652;
                v38 = 7.17;
                v2 = 72;
                v3 = 74.6;
                v4 = 44.9;
                v5 = 42;
                v11 = 3.72;
                v44 = 7.0;
                v40 = 6.16;
                v42 = 6.01;
                v46 = 6.08;
                v39 = 5.67;
                v41 = 5.44;
                v45 = 5.51;
                v34[1] = 64.8;
                v34[0] = 54.5;
                goto LABEL_163;
            }
            if (v8 == 23)
            {
                var_18 = 3.86;
                var_8 = 1.082;
                v48 = 0.658;
                v38 = 7.14;
                v2 = 72;
                v3 = 74.5;
                v4 = 44.2;
                v5 = 41.5;
                v11 = 3.75;
                v44 = 6.97;
                v40 = 6.14;
                v42 = 5.99;
                v46 = 6.04;
                v39 = 5.63;
                v41 = 5.4;
                v45 = 5.48;
                v34[1] = 64.9;
                v34[0] = 54.4;
                goto LABEL_163;
            }
            if (v8 == 24)
            {
                var_18 = 3.87;
                var_8 = 1.092;//
                v48 = 0.663;
                v38 = 7.11;
                v2 = 71.7;
                v3 = 74.4;
                v4 = 43.4;
                v5 = 40.9;
                v11 = 3.79;
                v44 = 6.95;
                v40 = 6.11;
                v42 = 5.97;
                v46 = 6.0;
                v39 = 5.59;
                v41 = 5.35;
                v45 = 5.44;
                v34[1] = 65;
                v34[0] = 54.3;
                goto LABEL_163;
            }
            if (v8 == 25)
            {
                var_18 = 3.89;
                var_8 = 1.099;
                v48 = 0.663;
                v2 = 71.3;
                v3 = 74.3;
                v4 = 42.8;
                v5 = 40.4;
                v11 = 3.82;
                v38 = 7.08;
                v44 = 6.92;
                v40 = 6.09;
                v42 = 5.96;
                v46 = 5.96;
                v39 = 5.55;
                v41 = 5.31;
                v45 = 5.41;
                v34[1] = 65.2;
                v43 = 71.3;
                v34[0] = 54.2;
                goto LABEL_164;
            }
            if (v8 == 26)
            {
                var_18 = 3.91;
                var_8 = 1.105;
                v48 = 0.663;
                v38 = 7.05;
                v2 = 71;
                v3 = 74.2;
                v4 = 42.1;
                v5 = 39.8;
                v11 = 3.85;
                v44 = 6.89;
                v40 = 6.07;
                v42 = 5.94;
                v46 = 5.92;
                v39 = 5.51;
                v41 = 5.27;
                v45 = 5.37;
                v34[1] = 65.2;
                v34[0] = 54;
                goto LABEL_163;
            }
            if (v8 == 27)
            {
                var_18 = 3.93;
                var_8 = 1.109;
                v48 = 0.658;
                v38 = 7.01;
                v2 = 70.8;
                v3 = 74.1;
                v4 = 41.5;
                v5 = 39.3;
                v11 = 3.89;
                v44 = 6.86;
                v40 = 6.04;
                v42 = 5.92;
                v46 = 5.87;
                v39 = 5.47;
                v41 = 5.22;
                v45 = 5.34;;
                v34[1] = 65.3;
                v34[0] = 53.8;
                goto LABEL_163;
            }
            if (v8 == 28)
            {
                var_18 = 3.95;
                var_8 = 1.112;
                v48 = 0.647;
                v38 = 6.98;
                v2 = 70.5;
                v3 = 74;
                v4 = 40.8;
                v5 = 38.7;
                v11 = 3.92;
                v44 = 6.83;
                v40 = 6.02;
                v42 = 5.9;
                v46 = 5.83;
                v39 = 5.43;
                v41 = 5.18;
                v45 = 5.3;
                v34[1] = 65.3;
                v34[0] = 53.5;
                goto LABEL_163;
            }
            if (v8 == 29)
            {
                var_18 = 3.97;
                var_8 = 1.112;
                v48 = 0.642;
                v38 = 6.95;
                v2 = 70.3;
                v3 = 73.7;
                v4 = 40.2;
                v5 = 38.2;
                v11 = 3.95;
                v44 = 6.8;
                v40 = 5.99;
                v42 = 5.88;
                v46 = 5.78;
                v39 = 5.39;
                v41 = 5.13;
                v45 = 5.26;
                v34[1] = 65.3;
                v34[0] = 53.2;
                goto LABEL_163;
            }
            if (v8 == 30)
            {
                var_18 = 3.99;
                var_8 = 1.115;
                v48 = 0.631;
                v38 = 6.91;
                v2 = 70.1;
                v3 = 73.4;
                v4 = 39.5;
                v5 = 37.6;
                v11 = 3.98;
                v44 = 6.77;
                v40 = 5.96;
                v42 = 5.86;
                v46 = 5.73;
                v39 = 5.35;
                v41 = 5.09;
                v45 = 5.23;
                memcpy(v34, "33333sJ@33333SP@", sizeof(v34));
                goto LABEL_163;
            }
            if (v8 == 31)
            {
                var_18 = 4.01;
                var_8 = 1.112;
                v11 = 4.01;
                v48 = 0.621;
                v38 = 6.88;
                v2 = 69.9;
                v3 = 73.1;
                v4 = 38.9;
                v5 = 37.1;
                v44 = 6.74;
                v40 = 5.94;
                v42 = 5.84;
                v46 = 5.68;
                v39 = 5.3;
                v41 = 5.04;
                v45 = 5.19;
                v34[1] = 65.2;
                v34[0] = 52.6;
                goto LABEL_163;
            }
            if (v8 == 32)
            {
                var_18 = 4.04;
                var_8 = 1.112;
                v11 = 4.04;
                v48 =0.604;
                v38 = 6.84;
                v2 = 69.7;
                v3 = 72.8;
                v4 = 38.3;
                v5 = 36.5;
                v44 = 6.71;
                v40 = 5.91;
                v42 = 5.82;
                v46 = 5.63;
                v39 = 5.26;
                v41 = 5.0;
                v45 = 5.15;
                memcpy(v34, "fffff&J@fffffFP@", sizeof(v34));
                goto LABEL_163;
            }
            if (v8 == 33)
            {
                var_18 = 4.06;
                var_8 = 1.109;
                v48 = 0.593;
                v38 = 6.8;
                v2 = 69.6;
                v3 = 72.4;
                v4 = 37.6;
                v5 = 35.9;
                v11 = 4.07;
                v44 = 6.68;
                v40 = 5.89;
                v42 = 5.8;
                v46 = 5.58;
                v39 = 5.22;
                v41 = 4.95;
                v45 = 5.11;
                v34[1] = 65.1;
                v34[0] = 51.9;
                goto LABEL_163;
            }
            if (v8 == 34)
            {
                var_18 = 4.09;
                var_8 = 1.105;
                v48 = 0.582;
                v38 = 6.76;
                v2 = 69.5;
                v3 = 72.1;
                v4 = 37;
                v5 = 35.4;
                v11 = 4.1;
                v44 = 6.64;
                v40 = 5.86;
                v42 = 5.78;
                v46 = 5.53;
                v39 = 5.17;
                v41 = 4.91;
                v45 = 5.08;
                v34[1] = 64.9;
                v34[0] = 51.6;
                goto LABEL_163;
            }
            if (v8 == 35)
            {
                var_18 = 4.11;
                var_8 = 1.099;
                v2 = v6;
                v48 = 0.571;
                v38 = 6.73;
                v3 = 71.8;
                v4 = 36.4;
                v5 = 34.8;
                v11 = 4.13;
                v44 = 6.61;
                v40 = 5.83;
                v42 = 5.75;
                v46 = 5.48;
                v39 = 5.13;
                v41 = 4.86;
                v45 = 5.04;
                v34[1] = 64.8;
                v34[0] = 51.3;
                goto LABEL_163;
            }
            if (v8 == 36)
            {
                var_18 = 4.14;
                var_8 = 1.095;
                v48 = 0.56;
                v38 = 6.69;
                v2 = 69.3;
                v3 = 71.5;
                v4 = 35.8;
                v5 = 34.3;
                v11 = 4.16;
                v44 = 6.58;
                v40 = 5.81;
                v42 = 5.73;
                v46 = 5.43;
                v39 = 5.09;
                v41 = 4.82;
                v45 = 5;
                v34[1] = 64.7;
                v34[0] = 51;
                goto LABEL_163;
            }
            if (v8 == 37)
            {
                var_18 = 4.17;
                var_8 = 1.089;
                v48 = 0.548;
                v38 = 6.65;
                v2 = 69.2;
                v3 = 71.2;
                v4 = 35.2;
                v5 = 33.8;
                v11 = 4.19;
                v44 = 6.55;
                v40 = 5.78;
                v42 = 5.71;
                v46 = 5.38;
                v39 = 5.04;
                v41 = 4.78;
                v45 = 4.96;
                v34[1] = 64.5;
                v34[0] = 50.7;
                goto LABEL_163;
            }
            if (v8 == 38)
            {
                var_18 = 4.19;
                var_8 = 1.082;
                v48 = 0.536;
                v38 = 6.61;
                v2 = 69.2;
                v3 = 70.9;
                v4 = 34.6;
                v5 = 33.3;
                v11 = 4.22;
                v44 = 6.51;
                v40 = 5.75;
                v42 = 5.68;
                v46 = 5.32;
                v39 = 5.0;
                v41 = 4.73;
                v45 = 4.92;
                v34[1] = 64.3;
                v34[0] = 50.5;
                goto LABEL_163;
            }
            if (v8 == 39)
            {
                var_18 = 4.22;
                var_8 = 1.072;
                v2 = v1;
                v48 = 0.531;
                v38 = 6.57;
                v3 = 70.6;
                v4 = 34;
                v5 = 32.7;
                v11 = 4.25;
                v44 = 6.48;
                v40 = 5.73;
                v42 = 5.66;
                v46 = 5.27;
                v39 = 4.95;
                v41 = 4.69;
                v45 = 4.88;
                v34[1] = 64.1;
                v34[0] = 50.2;
                goto LABEL_163;
            }
            if (v8 == 40)
            {
                var_18 = 4.25;
                var_8 = 1.065;
                v2 = v1;
                v48 = 0.519;
                v38 = 6.53;
                v3 = 70.3;
                v4 = 33.4;
                v5 = 32.2;
                v11 = 4.28;
                v44 = 6.45;
                v40 = 5.7;
                v42 = 5.64;
                v46 = 5.22;
                v39 = 4.91;
                v41 = 4.65;
                v45 = 4.85;
                v34[1] = 63.9;
                v34[0] = 50;
                goto LABEL_163;
            }
            if (v8 == 41)
            {
                var_18 = 4.28;
                var_8 = 1.054;
                v2 = v1;
                v48 = 0.513;
                v38 = 6.5;
                v3 = 70;
                v4 = 32.9;
                v5 = 31.7;
                v11 = 4.31;
                v44 = 6.42;
                v40 = 5.67;
                v42 = 5.61;
                v46 = 5.16;
                v39 = 4.87;
                v41 = 4.61;
                v45 = 4.81;
                v34[1] = 63.6;
                v34[0] = 49.8;
                goto LABEL_163;
            }
            if (v8 == 42)
            {
                var_18 = 4.3;
                var_8 = 1.044;
                v2 = v1;
                v48 = 0.513;
                v38 = 6.46;
                v3 = 69.8;
                v4 = 32.3;
                v5 = 31.2;
                v11 = 4.34;
                v44 = 6.38;
                v40 = 5.65;
                v42 = 5.59;
                v46 = 5.11;
                v39 = 4.82;
                v41 = 4.56;
                v45 = 4.77;
                v34[1] = 63.4;
                v34[0] = 49.7;
                goto LABEL_163;
            }
            if (v8 == 43)
            {
                var_18 = 4.33;
                var_8 = 1.033;
                v2 = v1;
                v48 = 0.507;
                v38 = 6.42;
                v3 = 69.6;
                v4 = 31.8;
                v5 = 30.8;
                v11 = 4.37;
                v44 = 6.35;
                v40 = 5.62;
                v42 = 5.57;
                v46 = 5.05;
                v39 = 4.78;
                v41 = 4.52;
                v45 = 4.73;
                v34[1] = 63.1;
                v34[0] = 49.6;
                goto LABEL_163;
            }
            if (v8 == 44)
            {
                var_18 = 4.36;
                var_8 = 1.022;
                v2 = v1;
                v3 = v6;
                v48 = 0.507;
                v38 = 6.38;
                v4 = 31.2;
                v5 = 30.3;
                v11 = 4.4;
                v44 = 6.32;
                v40 = 5.59;
                v42 = 5.54;
                v46 = 5.0;
                v39 = 4.74;
                v41 = 4.48;
                v45 = 4.69;
                v34[1] = 62.9;
                v34[0] = 49.5;
                goto LABEL_163;
            }
            if (v8 == 45)
            {
                var_18 = 4.39;
                var_8 = 1.008;
                v2 = v1;
                v48 = 0.507;
                v38 = 6.34;
                v3 = 69.2;
                v4 = 30.7;
                v5 = 29.8;
                v11 = 4.42;
                v44 = 6.29;
                v40 = 5.57;
                v42 = 5.52;
                v46 = 4.95;
                v39 = 4.69;
                v41 = 4.44;
                v45 = 4.65;
                v34[1] = 62.6;
                v34[0] = 49.5;
                goto LABEL_163;
            }
            if (v8 == 46)
            {
                var_18 = 4.42;
                var_8 = 0.997;
                v2 = v1;
                v3 = v1;
                v48 = 0.507;
                v38 = 6.31;
                v4 = 30.2;
                v5 = 29.4;
                v11 = 4.45;
                v44 = 6.25;
                v40 = 5.54;
                v42 = 5.49;
                v46 = 4.9;
                v39 = 4.65;
                v41 = 4.4;
                v45 = 4.62;
                v34[1] = 62.3;
                v34[0] = 49.5;
                goto LABEL_163;
            }
            if (v8 == 47)
            {
                var_18 = 4.44;
                var_8 = 0.982;
                v48 = 0.507;
                v38 = 6.27;
                v2 = 69.2;
                v3 = 68.9;
                v4 = 29.7;
                v5 = 29;
                v11 = 4.48;
                v44 = 6.22;
                v40 = 5.52;
                v42 = 5.47;
                v46 = 4.84;
                v39 = 4.61;
                v41 = 4.36;
                v45 = 4.58;
                v34[1] = 62;
                v34[0] = 49.6;
                goto LABEL_163;
            }
            if (v8 == 48)
            {
                var_18 = 4.47;
                var_8 = 0.971;
                v48 = 0.513;
                v38 = 6.23;
                v2 = 69.2;
                v3 = 68.8;
                v4 = 29.2;
                v5 = 28.6;
                v11 = 4.5;
                v44 = 6.19;
                v40 = 5.49;
                v42 = 5.44;
                v46 = 4.79;
                v39 = 4.57;
                v41 = 4.32;
                v45 = 4.54;
                v34[1] = 61.7;
                v34[0] = 49.7;
                goto LABEL_163;
            }
            if (v8 == 49)
            {
                var_18 = 4.5;
                var_8 = 0.956;
                v48 = 0.525;
                v2 = 69.2;
                v3 = 68.8;
                v4 = 28.7;
                v5 = 28.2;
                v11 = 4.52;
                v38 = 6.2;
                v44 = 6.16;
                v40 = 5.46;
                v42 = 5.42;
                v46 = 4.74;
                v39 = 4.53;
                v41 = 4.29;
                v45 = 4.5;
                v13 = 61.3;
                goto LABEL_16;
            }
            if (v8 == 50)
            {
                var_18 = 4.52;
                var_8 = 0.94;
                v3 = v9;
                v2 = 69.3;
                v48 = 0.531;
                v38 = 6.16;
                v4 = 28.3;
                v5 = 27.8;
                v11 = 4.55;
                v44 = 6.13;
                v40 = 5.44;
                v42 = 5.39;
                v46 = 4.69;
                v39 = 4.49;
                v41 = 4.25;
                v45 = 4.47;
                v34[1] = 61;
                v34[0] = 50.1;
                goto LABEL_163;
            }
            if (v8 == 51)
            {
                var_18 = 4.55;
                var_8 = 0.928;
                v3 = v9;
                v2 = 69.3;
                v48 = 0.542;
                v38 = 6.12;
                v4 = 27.9;
                v5 = 27.4;
                v11 = 4.57;
                v44 = 6.1;
                v40 = 5.42;
                v42 = 5.37;
                v46 = 4.64;
                v39 = 4.45;
                v41 = 4.21;
                v45 = 4.43;
                v34[1] = 60.7;
                v34[0] = 50.4;
                goto LABEL_163;
            }
            if (v8 == 52)
            {
                var_18 = 4.57;
                var_8 = 0.912;
                v3 = v9;
                v11 = 4.59;
                v48 = 0.548;
                v38 = 6.09;
                v2 = 69.3;
                v4 = 27.4;
                v5 = 27.1;
                v44 = 6.07;
                v40 = 5.39;
                v42 = 5.35;
                v46 = 4.59;
                v39 = 4.41;
                v41 = 4.18;
                v45 = 4.39;
                v34[1] = 60.3;
                v43 = 69.3;
                v34[0] = 50.7;
                goto LABEL_164;
            }
            if (v8 == 53)
            {
                var_18 = 4.6;
                var_8 = 0.896;
                v3 = v9;
                v4 = 27;
                v2 = v6;
                v48 = 0.56;
                v38 = 6.06;
                v5 = 26.7;
                v11 = 4.61;
                v44 = 6.04;
                v40 = 5.37;
                v42 = 5.32;
                v46 = 4.54;
                v39 = 4.37;
                v41 = 4.15;
                v45 = 4.36;
                v34[1] = 60;
                v34[0] = 50.9;
                goto LABEL_163;
            }
            if (v8 == 54)
            {
                var_18 = 4.62;
                var_8 = 0.884;
                v3 = v9;
                v4 = 26.6;
                v2 = v6;
                v48 = 0.56;
                v38 = 6.02;
                v5 = 26.4;
                v11 = 4.63;
                v44 = 6.01;
                v40 = 5.34;
                v42 = 5.3;
                v46 = 4.5;
                v39 = 4.33;
                v41 = 4.11;
                v45 = 4.32;
                v34[1] = 59.6;
                v34[0] = 51;
                goto LABEL_163;
            }
            if (v8 == 55)
            {
                var_18 = 4.65;
                var_8 = 0.867;
                v3 = v9;
                v4 = 26.3;
                v2 = v6;
                v11 = 4.65;
                v5 = 26.1;
                v48 = 0.565;
                v38 = 5.99;
                v44 = 5.98;
                v40 = 5.32;
                v42 = 5.27;
                v46 = 4.45;
                v39 = 4.29;
                v41 = 4.08;
                v15 = 4.28;
            LABEL_162:
                v45 = v15;
                goto LABEL_163;
            }
            if (v8 == 56)
            {
                var_18 = 4.67;
                var_8 = 0.85;
                v3 = v9;
                v4 = 25.9;
                v2 = v6;
                v11 = 4.67;
                v5 = 25.8;
                v48 = 0.571;
                v38 = 5.96;
                v44 = 5.95;
                v40 = 5.3;
                v42 = 5.25;
                v46 = 4.41;
                v39 = 4.26;
                v41 = 4.05;
                v15 = 4.25;
                goto LABEL_162;
            }
            if (v8 == 57)
            {
                var_18 = 4.69;
                var_8 = 0.837;
                v3 = v9;
                v4 = 25.6;
                v2 = v6;
                v11 = 4.69;
                v5 = 25.6;
                v48 = 0.571;
                v38 = 5.93;
                v44 = 5.92;
                v40 = 5.28;
                v42 = 5.23;
                v46 = 4.36;
                v39 = 4.22;
                v41 = 4.02;
                v15 = 4.21;
                goto LABEL_162;
            }
            if (v8 == 58)
            {
                var_18 = 4.71;
                var_8 = 0.824;
                v3 = v9;
                v4 = 25.3;
                v2 = v6;
                v5 = 25.3;
                v11 = 4.7;
                v48 = 0.571;
                v38 = 5.9;
                v44 = 5.9;
                v40 = 5.25;
                v42 = 5.2;
                v46 = 4.32;
                v39 = 4.19;
                v41 = 3.99;
                v15 = 4.18;
                goto LABEL_162;
            }
            if (v8 == 59)
            {
                var_18 = 4.73;
                var_8 = 0.806;
                v3 = v9;
                v4 = 25;
                v2 = v6;
                v5 = 25.1;
                v11 = 4.72;
                v48 = 0.571;
                v38 = 5.88;
                v44 = 5.87;
                v40 = 5.23;
                v42 = 5.18;
                v46 = 4.28;
                v39 = 4.16;
                v41 = 3.96;
                v15 = 4.15;
                goto LABEL_162;
            }
            if (v8 == 60)
            {
                var_18 = 4.75;
                var_8 = 0.793;
                v3 = v9;
                v4 = 24.7;
                v2 = v6;
                v5 = 24.9;
                v11 = 4.73;
                v48 = 0.571;
                v38 = 5.85;
                v44 = 5.85;
                v40 = 5.21;
                v42 = 5.16;
                v46 = 4.25;
                v39 = 4.12;
                v41 = 3.94;
                v15 = 4.11;
                goto LABEL_162;
            }
            if (v8 == 61)
            {
                var_18 = 4.77;
                var_8 = 0.779;
                v3 = v9;
                v4 = 24.5;
                v2 = v6;
                v5 = 24.7;
                v11 = 4.75;
                v48 = 0.571;
                v38 = 5.83;
                v44 = 5.82;
                v40 = 5.19;
                v42 = 5.14;
                v46 = 4.21;
                v39 = 4.09;
                v41 = 3.91;
                v15 = 4.08;
                goto LABEL_162;
            }
            if (v8 == 62)
            {
                var_18 = 4.79;
                var_8 = 0.765;
                v3 = v9;
                v4 = 24.3;
                v2 = v6;
                v5 = 24.5;
                v11 = 4.76;
                v48 = 0.571;
                v38 = 5.8;
                v44 = 5.8;
                v40 = 5.17;
                v42 = 5.12;
                v46 = 4.17;
                v39 = 4.06;
                v41 = 3.89;
                v15 = 4.05;
                goto LABEL_162;
            }
            if (v8 == 63)
            {
                var_18 = 4.8;
                var_8 = 0.756;
                v3 = v9;
                v2 = 69.3;
                v4 = 24.1;
                v5 = 24.3;
                v11 = 4.77;
                v48 = 0.571;
                v38 = 5.78;
                v44 = 5.78;
                v40 = 5.15;
                v42 = 5.1;
                v46 = 4.14;
                v39 = 4.04;
                v41 = 3.86;
                v15 = 4.02;
                goto LABEL_162;
            }
            if (v8 == 64)
            {
                var_18 = 4.82;
                var_8 = 0.742;
                v3 = v9;
                v2 = 69.3;
                v4 = 23.9;
                v5 = 24.2;
                v11 = 4.79;
                v48 = 0.565;
                v38 = 5.76;
                v44 = 5.75;
                v40 = 5.14;
                v42 = 5.08;
                v46 = 4.11;
                v39 = 4.01;
                v41 = 3.84;
                v15 = 3.99;
                goto LABEL_162;
            }
            if (v8 == 65)
            {
                var_18 = 4.83;
                var_8 = 0.732;
                v3 = v9;
                v2 = 69.2;
                v4 = 23.7;
                v5 = 24;
                v11 = 4.8;
                v48 = 0.565;
                v38 = 5.74;
                v44 = 5.73;
                v40 = 5.12;
                v42 = 5.06;
                v46 = 4.08;
                v39 = 3.98;
                v41 = 3.82;
                v15 = 3.96;
                goto LABEL_162;
            }
            if (v8 == 66)
            {
                var_18 = 4.84;
                var_8 = 0.723;
                v3 = v9;
                v4 = 23.6;
                v2 = v1;
                v5 = 23.9;
                v11 = 4.81;
                v48 = 0.56;
                v38 = 5.73;
                v44 = 5.71;
                v40 = 5.1;
                v42 = 5.04;
                v46 = 4.06;
                v39 = 3.96;
                v41 = 3.8;
                v15 = 3.93;
                goto LABEL_162;
            }
            if (v8 == 67)
            {
                var_18 = 4.86;
                var_8 = 0.713;
                v3 = v9;
                v4 = 23.5;
                v5 = 23.8;
                v11 = 4.82;
                v48 = 0.56;
                v38 = 5.71;
                v44 = 5.69;
                v40 = 5.08;
                v42 = 5.02;
                v46 = 4.03;
                v39 = 3.94;
                v41 = 3.79;
                v15 = 3.9;
            }
            else
            {
                if (v8 != 68)
                {
                    if (v8 == 69)
                    {
                        var_18 = 4.88;
                        var_8 = 0.698;
                        v3 = v9;
                        v4 = 23.4;
                        v11 = 4.83;
                        v48 = 0.554;
                        v38 = 5.69;
                        v44 = 5.66;
                        v40 = 5.06;
                        v42 = 4.98;
                        v46 = 3.99;
                        v39 = 3.9;
                        v41 = 3.76;
                        v15 = 3.85;
                    }
                    else
                    {
                        if (v8 == 70)
                        {
                            var_18 = 4.88;
                            var_8 = 0.693;
                            v3 = v9;
                            v11 = 4.84;
                            v48 = 0.554;
                            v38 = 5.68;
                            v44 = 5.64;
                            v40 = 5.04;
                            v42 = 4.96;
                            v46 = 3.97;
                            v39 = 3.88;
                            v41 = 3.75;
                            v15 = 3.82;
                        }
                        else
                        {
                            switch (v8)
                            {
                            case 'G':
                                var_18 = 4.89;
                                var_8 = 0.688;
                                v3 = v9;
                                v4 = 23.3;
                                v5 = 23.6;
                                v11 = 4.85;
                                v48 = 0.548;
                                v38 = 5.67;
                                v44 = 5.63;
                                v40 = 5.03;
                                v42 = 4.95;
                                v46 = 3.96;
                                v39 = 3.86;
                                v41 = 3.73;
                                v15 = 3.8;
                                goto LABEL_161;
                            case 'H':
                                var_18 = 4.89;
                                var_8 = 0.688;
                                v3 = v9;
                                v4 = 23.3;
                                v5 = 23.6;
                                v11 = 4.85;
                                v48 = 0.548;
                                v38 = 5.66;
                                v44 = 5.62;
                                v40 = 5.02;
                                v42 = 4.93;
                                v46 = 3.95;
                                v39 = 3.85;
                                v41 = 3.73;
                                v15 = 3.77;
                                goto LABEL_161;
                            case 'I':
                                var_18 = 4.89;
                                var_8 = 0.688;
                                v3 = v9;
                                v4 = 23.3;
                                v5 = 23.6;
                                v11 = 4.86;
                                v48 = 0.548;
                                v38 = 5.66;
                                v44 = 5.61;
                                v40 = 5.01;
                                v42 = 4.92;
                                v46 = 3.94;
                                v39 = 3.83;
                                v41 = 3.72;
                                v15 = 3.75;
                                goto LABEL_161;
                            case 'J':
                                var_18 = 4.9;
                                var_8 = 0.688;
                                v3 = v9;
                                v48 = 0.548;
                                v38 = 5.66;
                                v44 = 5.6;
                                v40 = 5.0;
                                v42 = 4.9;
                                v46 = 3.93;
                                v39 = 3.82;
                                v41 = 3.71;
                                v15 = 3.73;
                                break;
                            default:
                                if (v8 < 75)
                                    goto LABEL_165;
                                var_18 = 4.89;
                                var_8 = 0.693;
                                v3 = v9;
                                v48 = 0.542;
                                v38 = 5.66;
                                v44 = 5.59;
                                v40 = 4.99;
                                v42 = 4.89;
                                v46 = 3.93;
                                v39 = 3.81;
                                v15 = 3.71;
                                v41 = 3.71;
                                break;
                            }
                            v11 = 4.86;
                        }
                        v4 = 23.3;
                    }
                    v5 = 23.7;
                    goto LABEL_161;
                }
                else
                {
                    var_18 = 4.87;
                    var_8 = 0.703;
                }
                v3 = v9;
                v4 = 23.4;
                v5 = 23.8;
                v11 = 4.83;
                v48 = 0.554;
                v38 = 5.7;
                v44 = 5.68;
                v40 = 5.07;
                v42 = 5.0;
                v46 = 4.01;
                v39 = 3.91;
                v41 = 3.77;
                v15 = 3.87;
            }
        LABEL_161:
            v2 = 69;
            goto LABEL_162;
            v2 = 69;
            goto LABEL_162;
        }
        else
        {
            var_8 =  0;
            var_18 = 3.51;

        }
        v2 = 93.0;       // 93.0
        v3 = 95.0;       // 95.0
        v48 = 0.344;                // 0.344
        v38 = 7.39;
        v44 = 7.33;
        v40 = 6.53;
        v42 = 6.13;
        v46 = 6.32;
        v39 = 6.23;
        v41 = 6.25;
        v10 = 6.06;                // v10=6.06
    LABEL_4:
        v11 = 3.58;                // v11=3.58
        v12 = 47;                // 47
    LABEL_5:
        v5 = 48.8;       // 48.8
        v4 = 54.0;       // 54.0
        v45 = v10;
        v43 = v2;
        v34[1] = v12;
        v34[0] = v12;
    LABEL_164:
        v36 = v3;
        v37 = v4;
        v47 = v11;
        v35 = v5;
    LABEL_165:
        v17 = v2;
        v18 = 5 * v8;
        v19 = v3;
        v20 = v5;
        v21 = v4;

        HrvParameters[2 * v18 + 34] = v17;
        HrvParameters[2 * v18 + 1234] = v19;
        HrvParameters[10 * v8 + 30] = v17 - 20.6;
        HrvParameters[2 * v18 + 32] = v17 - 10.3;

        HrvParameters[10 * v8 + 2434] = v21;
        HrvParameters[10 * v8 + 3634] = v20;
        HrvParameters[10 * v8 + 36] = v17+10.3;// +10.3
        HrvParameters[10 * v8 + 38] = v17 + 20.6;
        HrvParameters[10 * v8 + 1230] = v19 - 20.56;
        HrvParameters[10 * v8 + 1232] = v19 - 10.28;
        HrvParameters[10 * v8 + 1236] = v19 + 10.28;// + 10.28
        HrvParameters[10 * v8 + 1238] = v19 + 20.56;
        HrvParameters[10 * v8 + 2430] = v21 - 20.0448;
        HrvParameters[10 * v8 + 2432] = v21 - 8.1432;
        HrvParameters[10 * v8 + 2436] = v21 + 8.1432;// 8.1432
        HrvParameters[10 * v8 + 2438] = v21 + 20.0448;
        HrvParameters[10 * v8 + 3630] = v20 - 19.2256;
        HrvParameters[10 * v8 + 3632] = v20 - 7.8104;
        HrvParameters[10 * v8 + 3636] = v20 + 7.8104;// 7.8104
        HrvParameters[10 * v8 + 3638] = v20 + 19.2256;
        HrvParameters[10 * v8 + 4830] = exp(v11 - 0.7);//libm_sse2_exp_precise().m128_u64[0];// v11-0.7 e 次方
        HrvParameters[10 * v8 + 4832] = exp(v11 - 0.4);// v11-0.4
        HrvParameters[10 * v8 + 4834] = exp(v11);// e3.58
        HrvParameters[10 * v8 + 4836] = exp(v11 + 0.4);// v11+0.4 e开发
        HrvParameters[10 * v8 + 4838] = exp(v11 + 0.7);// v11+0.7 e开发
        HrvParameters[10 * v8 + 6030] = exp(var_18 - 0.7);// 3.51-0.7 e
        HrvParameters[10 * v8 + 6032] = exp(var_18 - 0.4);// 3.51-0.4
        HrvParameters[10 * v8 + 6034] = exp(var_18);
        HrvParameters[10 * v8 + 6036] = exp(var_18 + 0.4);
        HrvParameters[10 * v8 + 6038] = exp(var_18 + 0.7);
        HrvParameters[10 * v8 + 7230] = exp(var_8 - 1.0);
        HrvParameters[10 * v8 + 7232] = exp(var_8 - 0.4);
        HrvParameters[10 * v8 + 7234] = exp(var_8);
        HrvParameters[10 * v8 + 7236] = exp(var_8 + 0.4);
        HrvParameters[10 * v8 + 7238] = exp(var_8 + 1.0);
        HrvParameters[10 * v8 + 8430] = exp(v48 - 1.0);// v48
        HrvParameters[10 * v8 + 8432] = exp(v48 - 0.4);
        HrvParameters[10 * v8 + 8434] = exp(v48);
        HrvParameters[10 * v8 + 8436] = exp(v48 + 0.4);
        HrvParameters[10 * v8 + 8438] = exp(v48 + 1.0);

        HrvParameters[10 * v8 + 9634] = v38;
        HrvParameters[10 * v8 + 9630] = v38 - 1.1904;
        HrvParameters[10 * v8 + 9632] = v38 - 0.4836;
        HrvParameters[10 * v8 + 9636] = v38 + 0.4836;
        HrvParameters[10 * v8 + 9638] = v38 + 1.1904;

        HrvParameters[10 * v8 + 10834] = v44;
        HrvParameters[10 * v8 + 10830] = v44 - 1.1648;
        HrvParameters[10 * v8 + 10832] = v44 - 0.4732;
        HrvParameters[10 * v8 + 10836] = v44 + 0.4732;
        HrvParameters[10 * v8 + 10838] = v44 + 1.1648;

        HrvParameters[10 * v8 + 12034] = v40;
        HrvParameters[10 * v8 + 12030] = v40 - 1.3312;
        HrvParameters[10 * v8 + 12032] = v40 - 0.5408000000000001;
        HrvParameters[10 * v8 + 12036] = v40 + 0.5408000000000001;
        HrvParameters[10 * v8 + 12038] = v40 + 1.3312;

        HrvParameters[10 * v8 + 13230] = v42 - 1.2928;
        HrvParameters[10 * v8 + 13232] = v42 - 0.5252;
        HrvParameters[10 * v8 + 13234] = v42;
        HrvParameters[10 * v8 + 13236] = v42 + 0.5252;
        HrvParameters[10 * v8 + 13238] = v42 + 1.2928;

        HrvParameters[10 * v8 + 14434] = v46;
        double v27 = v45;
        HrvParameters[10 * v8 + 18034] = v27;
        HrvParameters[10 * v8 + 14430] = v46 - 1.4592;
        HrvParameters[10 * v8 + 14432] = v46 - 0.5928;
        HrvParameters[10 * v8 + 14436] = v46 + 0.5928;
        HrvParameters[10 * v8 + 14438] = v46 + 1.4592;

        HrvParameters[10 * v8 + 15634] = v39;
        HrvParameters[10 * v8 + 15630] = v39 - 1.4464;
        HrvParameters[10 * v8 + 15632] = v39 - 0.5876;
        HrvParameters[10 * v8 + 15636] = v39 + 0.5876;
        HrvParameters[10 * v8 + 15638] = v39 + 1.4464;

        HrvParameters[10 * v8 + 16834] = v41;
        HrvParameters[10 * v8 + 16830] = v41 - 1.4848;
        HrvParameters[10 * v8 + 16832] = v41 - 0.6032;
        HrvParameters[10 * v8 + 16836] = v41 + 0.6032;
        HrvParameters[10 * v8 + 16838] = v41 + 1.4848;

        HrvParameters[10 * v8 + 18030] = v27 - 1.536;
        HrvParameters[10 * v8 + 18032] = v27 - 0.624;
        HrvParameters[10 * v8 + 18036] = v27 + 0.624;
        HrvParameters[10 * v8 + 18038] = v27 + 1.536;


        HrvParameters[10 * v8 + 19234] = v34[1];
        HrvParameters[10 * v8 + 19230] = v34[1] / 3.0;
        result = 5 * v8;
        HrvParameters[10 * v8 + 19232] = v34[1] / 3.0 * 2.0 - 3.7;
        HrvParameters[10 * v8 + 19236] = v34[1] + 10;
        HrvParameters[10 * v8 + 19238] = v34[1] + 20;

        HrvParameters[10 * v8 + 20434] = v34[0];
        HrvParameters[10 * v8 + 20430] = v34[0] / 3.0;
        HrvParameters[10 * v8 + 20432] = v34[0] / 3.0 * 2.0;
        HrvParameters[10 * v8 + 20436] = v34[0] + 10;
        HrvParameters[10 * v8 + 20438] = v34[0] + 20;





        v4 = v37;
        ++v8;
        v5 = v35;
        v2 = v43;
        v3 = v36;
        v9 = 68.7;
        v6 = 68.4;
        v1 = 69.1;

    }
    while (v8 < 120);
}
double HRVDataProcess::Cacul_Psi(int* rr_buf, int rr_len, int* a7, int len)
{
    int v4, v5;
    int i, j;
    double v23;

    v4 = 300;
    v5 = 2000;
    if (len > 0)
        memset(a7, 0, 4 * len);

    for (i = 0; i < rr_len; i++)
    {
        if (rr_buf[i] < 2000 && rr_buf[i] > 300)
        {
            a7[rr_buf[i] - 300]++;

            if (v4 < rr_buf[i])
                v4 = rr_buf[i];
            if (v5 > rr_buf[i])
                v5 = rr_buf[i];
        }
    }
    v23 = (double)(v4 - v5) / 1000.0;
    int  v26[680];
    memset(v26, 0, 680 * 4);
    signed int v12;
    if (rr_len > 0)
    {
        for (i = 0; i < rr_len; i++)
        {
            if (rr_buf[i] < 2000 && rr_buf[i] > 300)
            {
                v12 = 4 * (int)((double)(rr_buf[i] - 300) / -10.0);
                v26[-v12] ++;
            }
        }

    }
    int v13 = 0;
    int v14 = 0;
    for (j = 0; j < 170; ++j)
    {
        if (v14 < v26[j * 4])
        {
            v14 = v26[j * 4];
            v13 = j;
        }

    }
    double v22 = v14;
    v22 = v22 / (double)rr_len * 100.0;
    int v18 = 0;
    double v17 = 0.0;
    double v20;
    if (rr_len > 0)
    {
        for (i = 0; i < rr_len; i++)
        {
            v20 = (double)rr_buf[i];
            if (v20 > (double)v13 * 10.0 + 300.0 && (double)(v13 + 1) * 10.0 + 300.0 >= v20)
            {
                ++v18;
                v17 = v17 + v20 / 1000.0;
            }
        }
    }


    return v22 / (v17 / (double)v18 * 2.0 * v23);
}
double HRVDataProcess::Cacul_Apen(int rr_len, int* rr_buf)
{
    int i, j;
    double v6 = 0.0;
    double rr_mean;
    double var_sum = 0.0;

    for (i = 0; i < rr_len; i++)
    {
        v6 += rr_buf[i];
    }
    rr_mean = v6 / rr_len;

    for (i = 0; i < rr_len; i++)
    {
        v6 = rr_buf[i];
        var_sum += (v6 - rr_mean) * (v6 - rr_mean);
    }

    double v21 = sqrt(var_sum / rr_len);
    int v22 = rr_len - 1;
    int v23 = 0;
    double v24 = v21 * 0.2;
    for (i = 0; i < v22; ++i)
    {
        for (j = 0; j < v22; ++j)
        {
            if (v24 >= fabs((double)rr_buf[j] - (double)rr_buf[i])
                && v24 >= fabs((double)rr_buf[j + 1] - (double)rr_buf[i + 1]))
            {
                ++v23;
            }

        }

    }
    double xmm6 = v23;

    xmm6 = xmm6 / v22;
    xmm6 = xmm6 / v22;

    int v27 = 0;
    int v28 = rr_len - 2;
    int v30 = rr_len - 2;
    int* v29 = &rr_buf[2];
    int* v31 = &rr_buf[2];
    if (v28 > 0)
    {
        while (1)
        {
            if (v24 >= fabs((double)*(v29 - 2) - (double)*(v31 - 2))
                && v24 >= fabs((double)*(v29 - 1) - (double)*(v31 - 1))
                && v24 >= fabs((double)*v29 - (double)*v31))
            {
                ++v27;
            }
            ++v29;
            if (!--v28)
            {
                v29 = &rr_buf[2];
                ++v31;
                v28 = rr_len - 2;
                if (!--v30)
                    break;
            }
        }
    }
    double xmm0 = v27;
    xmm0 = xmm0 / (rr_len - 2);
    xmm0 = xmm0 / (rr_len - 2);

    xmm6 = xmm6 / xmm0;
    return log(xmm6);
}

void HRVDataProcess::fit_rr(int* rr_raw_buf, double* rr_fit_buf, int data_len)
{
    int v30;
    int i;
    int v28, v29;
    int result;
    int v12, v11, v7, v6 = 0;
    signed int v13, v26;
    int v15;
    int v16;
    int v17;
    int v27;
    double v19;
    double* v18;
    double v22, v23;
    for (i = 0; i < data_len; i++)
    {
        rr_fit_buf[i] = 0.0;
    }
    for (i = 0; i < data_len; i++)
    {
        if (rr_raw_buf[i] != 0)
        {
            v30 = rr_raw_buf[i];
            break;
        }
    }
    rr_raw_buf[0] = 1052;
    for (v11 = 0; v11 < data_len; v28 = v11)
    {
        result = rr_raw_buf[v11];
        v29 = result;
        if (result)
        {
            v12 = v6;
            if (v6 < v11)
            {
                v13 = v11 - v6;
                v26 = v11 - v6;
                if (v11 - v6 >= 4)
                {
                    v15 = v11 - v6;
                    v16 = 2;
                    v17 = ((unsigned int)(v15 - 4) >> 2) + 1;
                    v27 = v6 + 4 * v17;
                    v18 = rr_fit_buf + v6 + 2;

                    v19 = (double)(result - v30) / v13;
                    do
                    {
                        *(v18 - 2) = rr_raw_buf[v6] + (double)(int)(v16 - 2) * v19;
                        *(v18 - 1) = rr_raw_buf[v6] + (double)(int)(v16 - 1) * v19;
                        *(v18) = rr_raw_buf[v6] + (double)(int)(v16)*v19;
                        *(v18 + 1) = rr_raw_buf[v6] + (double)(int)(v16 + 1) * v19;
                        v16 += 4;
                        v18 += 4;
                        --v17;
                    } while (v17);
                    v12 = v27;
                    v11 = v28;
                    v13 = v26;
                    result = v29;
                }
                if (v12 < v11)
                {
                    v22 = (double)(result - v30);
                    result = v12 - v6;
                    v23 = v22 / (double)v13;
                    do
                    {
                        result++;
                        *(rr_fit_buf + v12++) = result * v23 + (double)rr_raw_buf[v6];
                    } while (v12 < v11);
                }
            }

            v7 = v29;
            v6 = v11;
            v30 = v29;
        }
        v11++;
    }

    if (v6 < data_len)
    {

        double* v25 = (double*)(rr_fit_buf + v6);
        for (i = 0; i < 4 * (((data_len - v6) - 5) >> 2); i++)
            v25[i] = (double)v7;
    }
}

void HRVDataProcess::ResampleRR(double* fit_rr_buf, int fit_rr_len)
{
    int i, j;

    for (i = 0, j = 0; j < fit_rr_len; i++, j += 250)
    {
        Resample_rr_buf[i] = fit_rr_buf[j];
    }


}
int HRVDataProcess::cal_fft_len(int len)
{
    int v1; // eax
    int i; // ecx
    int result; // eax

    v1 = len;
    for (i = 0; v1 != 1; v1 /= 2)
        ++i;
    result = 1;
    if (i > 0)
    {
        do
        {
            result *= 2;
            --i;
        } while (i);
    }
    return result;
}
void HRVDataProcess::PreprocessResampleRR(double* rs_rr_buf)
{
    int i = 0;
    int a3 = PPG_DATA_LEN / 250;
    double xmm4_8_1 = 0.0;
    double xmm6_1 = 0.0;
    double xmm3_1 = 0.0;
    double xmm5_1 = 0.0;
    double xmm7_8_1 = 0.0;
    double xmm1_8_2;
    double xmm2_8_2, xmm1_3, xmm0_3;
    int eax2 = 0;

    for (xmm4_8_1 = 0.0; i < a3; xmm6_1 = xmm6_1 + (double)eax2)
    {
        xmm1_8_2 = rs_rr_buf[i];
        xmm2_8_2 = (double)i;
        eax2 = i * i;
        ++i;
        *(double*)&xmm5_1 = *(double*)&xmm5_1 + xmm2_8_2;
        xmm7_8_1 = xmm7_8_1 + xmm1_8_2;
        xmm4_8_1 = xmm4_8_1 + xmm1_8_2 * xmm2_8_2;
    }

    xmm1_3 = xmm5_1;
//    double* esi3 = rs_rr_buf;
    int ecx3 = 0;
    xmm1_3 = *(double*)&xmm5_1 * *(double*)&xmm5_1 - (double)a3 * xmm6_1;
    xmm0_3 = a3;

    double xmm2_8_3 = (xmm7_8_1 * xmm5_1 - xmm0_3 * xmm4_8_1) / xmm1_3;
    double xmm4_8_3 = (xmm4_8_1 * xmm5_1 - xmm6_1 * xmm7_8_1) / xmm1_3;

    xmm0_3 = xmm2_8_3;
    xmm6_1 = xmm4_8_3;

    for (; ecx3 < a3; ++ecx3)
        PrePro_rr_buf[ecx3] = (double)ecx3 * xmm2_8_3 + xmm4_8_3;
//    int ecx9 = 0;

    if ((unsigned int)a3 >= 2)
    {
        for (i = 0; i < a3; i++)
        {
            PrePro_rr_buf[i] = rs_rr_buf[i] - PrePro_rr_buf[i];
        }

    }

    for (i = 0; i < a3; ++i)
        xmm3_1 = xmm3_1 + PrePro_rr_buf[i];
    xmm3_1 = xmm3_1 / a3;
    for (i = 0; i < a3; ++i)
        PrePro_rr_buf[i] = PrePro_rr_buf[i] - xmm3_1;

    int fft_len = cal_fft_len(PPG_DATA_LEN / 250);




    int v27 = fft_len;
    double* v24 = new double[fft_len];
    double* v80 = new double[fft_len];
    double* v81 = new double[fft_len];
    i = 0;
    do
    {

        v24[i] = v80[i] = PrePro_rr_buf[i];
        v81[i] = 0;
        i++;
        --v27;
    } while (v27);

    double xmm1_8_1 = 0.0;

    for (i = 0.0; i < fft_len; i++)
    {
        xmm1_8_2 = (1.0 - cos(i * 6.283184 / 256)) * 0.5;
        v81[i] = v80[i] * xmm1_8_2;


        xmm1_8_1 = xmm1_8_2 * xmm1_8_2 + xmm1_8_1;
    }
    double v77 = xmm1_8_1 / fft_len;


    FFT(v81, f, dst, 256, 2);
    for (i = 0; i < 256; i++)
        dst[i] = dst[i] / v77;
    VLF = 0;
    LF = 0;
    HF = 0;
    for (i = 0; i < 128; i++)
    {
        if (f[i] >= 0.001 && f[i] < 0.04)
            VLF += dst[i];
        if (f[i] >= 0.04 && f[i] < 0.15)
            LF += dst[i] ;
        if (f[i] >= 0.15 && f[i] < 0.4)
            HF += dst[i] ;
    }
    TP = VLF + LF + HF;
    LFNorm = LF * 100 / (LF + HF);
    HFNorm = HF * 100 / (LF + HF);
    LFHFRatio = LF / HF;


    delete[] v24;
    delete[] v80;
    delete[] v81;

}
/**
 * 计算hrv的主代码
 * @brief HRVDataProcess::ComputeHRV
 * @param p_data_buf rr间期
 * @param dwDataLen rr间期长度
 */
void HRVDataProcess::ComputeHRV(int* p_data_buf,int dwDataLen)
{
    int rr_len = 0;
    int i;
    for (i = 0; i < dwDataLen; i++)
    {
        if (p_data_buf[i])
            rr_len++;
    }
    g_RRFitBuf = new double[dwDataLen];
    int* temp_RRBuf;
    int *g_RRDataBuf = new int[rr_len];
    temp_RRBuf = new int[rr_len];
    int j = 0;
    int temp;
    for (i = 0; i < dwDataLen; i++)
    {
        temp = p_data_buf[i];
        if (temp)
        {
            g_RRDataBuf[j] = temp_RRBuf[j] = temp;
            j++;
        }

    }
    //预处理,将偏离均值比较大的以均值代替
    double rr_sum = 0.0;
    double rr_mean = 0.0;
    for (i = 0; i < rr_len; i++)
    {
        rr_sum += g_RRDataBuf[i];
    }

    rr_mean = rr_sum / rr_len;
    double rr_square_sum = 0.0;
    double tmp_d;
    for (i = 0; i < rr_len; i++)
    {
        tmp_d = g_RRDataBuf[i];
        rr_square_sum += (tmp_d - rr_mean) * (tmp_d - rr_mean) / rr_len;
    }
    double sum_sqrt = sqrt(rr_square_sum);
    int v23 = (int)rr_mean;
    rr_abnormal_count=0;
    for (i = 0; i < rr_len; i++)
    {
        tmp_d = g_RRDataBuf[i];
        if (tmp_d > (rr_mean + 3 * sum_sqrt) || tmp_d < (rr_mean - 3 * sum_sqrt))
        {
            rr_abnormal_count++;
        }
    }
    for (i = 0; i < rr_len; i++)
    {
        tmp_d = g_RRDataBuf[i];
        if (tmp_d > (rr_mean + 2 * sum_sqrt) || tmp_d < (rr_mean - 2 * sum_sqrt))
        {
            temp_RRBuf[i] = v23;
        }
        v23 = temp_RRBuf[i];
    }


    //计算异常心率
    double v33 = 0.0;
    for (i = 0; i < rr_len; i++)
    {
        v33 += temp_RRBuf[i];
    }

    double v35 = v33 / rr_len;
    double v37 = v35;
    double v39 = v35;

    for (i = 0; i < rr_len; i++)
    {
        v39 = v35;
        v35 = v37;
        v37 = g_RRDataBuf[i];
        if (v37 > v39 * 1.3 || v37 < v39 * 0.7)
        {

            g_RRDataBuf[i] = (int)((v39 + v35) * 0.5);
            v37 = (v39 + v35) * 0.5;
        }
    }


    for (i = 0, j = 0; i < dwDataLen; i++)
    {
        if (p_data_buf[i])
        {
            p_data_buf[i] = g_RRDataBuf[j++];
        }

    }

    if (rr_len > 1)
    {//rr间期长度大于0
        for (i = 0, j = 0; i < dwDataLen; i++)
        {
            if (p_data_buf[i])
            {
                g_RRDataBuf[j++] = p_data_buf[i];
            }

        }
        double rr_min = 99999.0, rr_max = -99999.0, rr_mean = 0.0,diff_rr_mean=0.0;


        QList<int>diff_rr;
        for (i = 0; i < rr_len; i++)
        {
            if (rr_max < g_RRDataBuf[i])
                rr_max = g_RRDataBuf[i];
            if (rr_min > g_RRDataBuf[i])
                rr_min = g_RRDataBuf[i];
            rr_mean += g_RRDataBuf[i];
            if(i<rr_len-1){
                diff_rr.append(g_RRDataBuf[i+1]-g_RRDataBuf[i]);
                diff_rr_mean+=g_RRDataBuf[i+1]-g_RRDataBuf[i];
            }
        }
        DRR=rr_max-rr_min;

        MeanNN = rr_mean / rr_len;
        MeanHrt = 60000.0 / MeanNN;
        MaxHrt = 60000.0 / rr_min;
        MinHrt = 60000.0 / rr_max;

        double MeanNN_diff=diff_rr_mean/(rr_len-1);

        RRList.clear();
        double v5 = 0.0;
        for (i = 0; i < rr_len; i++)
        {
            tmp_d = g_RRDataBuf[i];
            v5 += (tmp_d - MeanNN) * (tmp_d - MeanNN);
            RRList.append(tmp_d);
        }
        NN50=0;
        double v_diff=0.0;
        for(int i=0;i<rr_len-1;i++)
        {
            v_diff+=(RRList.at(i)-MeanNN_diff) * (RRList.at(i)-MeanNN_diff);
            if (abs(RRList.at(i+1)- RRList.at(i)) > 50)
                NN50++;
        }
        pNN50=(double)NN50*100/(rr_len-1);
        Sdnn = sqrt(v5 / rr_len);
        CV=Sdnn/MeanNN*100;
        SDSD=sqrt(v_diff/(rr_len-1));

        v5 = 0.0;
        double tmp_d1;
        for (i = 1; i < rr_len; i++)
        {
            tmp_d1 = g_RRDataBuf[i];
            tmp_d = g_RRDataBuf[i - 1];
            v5 += (tmp_d1 - tmp_d) * (tmp_d1 - tmp_d);
        }

        Rmssd = sqrt(v5 / (rr_len - 1));
        Psi = Cacul_Psi(g_RRDataBuf, rr_len, a7, 1700);
        Apen = Cacul_Apen(rr_len, g_RRDataBuf);


        fit_rr(p_data_buf, g_RRFitBuf, dwDataLen);//rr间期拟合
        ResampleRR(g_RRFitBuf, dwDataLen);
        PreprocessResampleRR(Resample_rr_buf);

        tpScore=Cal_TpScore(TP, age,gender);
        MsiScore = Cal_MsiScore(LFHFRatio, age,gender);
        SdnnScore = CalSdnnScore(Sdnn, age,gender);
        PsiScore = CalPsiScore(Psi, age,gender);
        lfScore=CalLfScore(LF, age,gender);
        CalHrtstate(MeanHrt, age,gender);
        hfScore=CalHfScore(HF, age,gender);
        AnsScore = Cal_ANSBalance(LFNorm, age,gender);
        Ans_State = Cal_ANSBalanceState(AnsScore,age);
        //AnsScore得分范围不是0-100，
        if(Ans_State==0)
            AnsScore=0+rand()%30;
        if(Ans_State==1)
            AnsScore=30+rand()%30;
        if(Ans_State==2)
            AnsScore=70+rand()%30;
        TotalScore = Cal_TotolScore(PsiScore, SdnnScore, MsiScore);
        EmotionScore= Cacul_Emotion(LFHFRatio);
        GetResult();


    }

    delete[] temp_RRBuf;
    delete[] g_RRDataBuf;
    delete[] g_RRFitBuf;
}



void HRVDataProcess::GetResult()
{
    int r1=0;
    int r2=0;
    int r3=0;
    int r4=0;
    if(Sdnn>65){
        r1=1;
    }else if(Sdnn<25){
        r1=-1;
    }
    if(SDSD>50){
        r2=1;
    }else if(SDSD<15){
        r2=-1;
    }
    if(Rmssd>50){
        r3=1;
    }else if(Rmssd<15){
        r3=-1;
    }
    if(pNN50>54){
        r4=1;
    }else if(pNN50<4.4){
        r4=-1;
    }
    int r=r1+r2+r3+r4;
    if(r<=-3){
        HRV_Res="🌂您的心率变异性降低，容易引起心脏猝死，间隔几日多次测量，如果多次测量结果显示心率变异性还是降低，建议去医院做全面检测。";
    }else if(r==4){
        HRV_Res="🌂您的心率变异性偏大，怀疑您心律失常或者检测过程中出现穿戴传感器的手指移动频繁，如是前者，建议多次检测，并结合日常观察来判定和评估被测的真实状况。";
    }else{
        HRV_Res="🌂您的心率变异性检测结果正常，反映的是一种正常的状态，即自主神经系统对于窦房结的调控在正常范围内。";
    }


    QString HRConclu;
    if(MeanHrt < 60)
        HRConclu = "🌂您的平均心率小于60，处于窦性心动过缓。\n成人安静时心率低于60次/分钟（一般在45次/分钟以上），称为窦性心动过缓，可见于长期从事重体力劳动的健康人和运动员；";
    else if (MeanHrt <= 100)
        HRConclu = "🌂您的平均心率处于正常心率范围。";
    else if (MeanHrt <= 160)
        HRConclu = "🌂处于窦性心动过速。\n成人安静时心率超过100次/分钟（一般不超过160次/分钟），称为窦性心动过速，是常见的一种心动过速，其发生常与交感神经兴奋及迷走神经张力降低有关，它可能由生理因素引发，也可能由病理因素引发。";
    else
        HRConclu = "🌂处于阵发性心动过速。";

    QString AbnormalConclu;
    if(rr_abnormal_count>=5)
    {
        AbnormalConclu="🌂检测中晃动手指或者心率不齐下会出现异常心率过多的情况。建议重新检测，如果在非移动手指的情况下出现至少5次，并且经常出现心悸，胸痛，呼吸困难时，需要咨询大夫做进一步检查！";
    }else
    {
        AbnormalConclu="🌂检测中未出现过多的异常心率。";
    }

    QString SPoxConclu;
    if(Spox < 85)
        SPoxConclu = "🌂处于重度低氧血症。\n血氧饱和度是呼吸循环、身体健康的重要生理指标。健康人体血氧饱和度正常范围是95%以上，当血氧饱和度在90%~94%时为供氧不足状态，低于90%为轻度低氧血症，低于85%为重度低氧血症。血氧饱和度较低对机体有着巨大的影响，比如对中枢神经系统，肝、肾功能的影响，应立即到医院进一步检查，及时消除会导致缺氧的因素。平时应多参加体育锻炼来增强心肺功能，维持正常的血氧饱和度。";
    else if (Spox < 90)
        SPoxConclu = "🌂处于轻度低氧血症。\n血氧饱和度是呼吸循环、身体健康的重要生理指标。健康人体血氧饱和度正常范围是95%以上，当血氧饱和度在90%~94%时为供氧不足状态，低于90%为轻度低氧血症，低于85%为重度低氧血症。血氧饱和度较低对机体有着巨大的影响，比如对中枢神经系统，肝、肾功能的影响，应立即到医院进一步检查，及时消除会导致缺氧的因素。平时应多参加体育锻炼来增强心肺功能，维持正常的血氧饱和度。";
    else if (Spox < 95)
        SPoxConclu = "🌂处于供氧不足。\n血氧饱和度是呼吸循环、身体健康的重要生理指标。健康人体血氧饱和度正常范围是95%以上当血氧饱和度在90%~94%时为供氧不足状态，低于90%为轻度低氧血症，低于85%为重度低氧血症。血氧饱和度较低对机体有着巨大的影响，比如对中枢神经系统，肝、肾功能的影响，应立即到医院进一步检查，及时消除会导致缺氧的因素。平时应多参加体育锻炼来增强心肺功能，维持正常的血氧饱和度。";
    else
        SPoxConclu = "🌂处于正常血氧范围。\n血氧饱和度是呼吸循环、身体健康的重要生理指标。健康人体血氧饱和度正常范围是95%以上，当血氧饱和度在90%~94%时为供氧不足状态，低于90%为轻度低氧血症，低于85%为重度低氧血症。血氧饱和度较低对机体有着巨大的影响，比如对中枢神经系统，肝、肾功能的影响，应立即到医院进一步检查，及时消除会导致缺氧的因素。平时应多参加体育锻炼来增强心肺功能，维持正常的血氧饱和度。";

    SL_Res=HRConclu+"\n\n"+AbnormalConclu+"\n\n"+SPoxConclu;


    QString psi_conclu;
    if(PSI_State==0 )
    {
        psi_conclu="🌂经检测您的身体压力极小阶段。说明身体处于精力充沛状态，身体能量储备及活力水平优良，免疫状态优良。";
    }else if(PSI_State==1)
    {
        psi_conclu="🌂经检测您的身体压力处于较小阶段。说明身体处于精力充沛状态，身体能量储备及活力水平良好，免疫状态良好。";
    }else if(PSI_State==2)
    {
        psi_conclu="🌂经检测您的身体压力处于正常阶段。说明身体处于一般状态，身体能量储备及活力水平一般，免疫状态一般。";
    }else if(PSI_State==3)
    {
        psi_conclu="🌂经检测您的身体压力处于较高阶段。请您注意休息和适当的放松。";
    }else
    {
        psi_conclu="🌂经检测您的身体压力处于极高阶段。请您注意休息和放松。使身体储备更多的能量及活力。";
    }

    QString msi_conclu;
    if(MSI_State==0 )
    {
        msi_conclu="🌂经检测您的精神压力处于极小阶段。学习和工作主动性、专注性强，效率高。";
    }else if(MSI_State==1)
    {
        msi_conclu="🌂经检测您的精神压力处于较小阶段。学习和工作主动性、专注性较强，效率高。";
    }else if(MSI_State==2)
    {
        msi_conclu="🌂经检测您的精神压力处于正常阶段。可能存在中等程度的疲劳；免疫力可能有所下降；工作和生活的热情度和专注性可能不够高。";
    }else if(MSI_State==3)
    {
        msi_conclu="🌂经检测您的精神压力处于较高阶段。身体能量消耗较大；免疫力可能显著下降；可能存在心境不佳、工作倦怠、注意力不集中、记忆力减退等状况。请您适当的放松心情，避免长期处于高压之下。";
    }else
    {
         msi_conclu="🌂经检测您的精神压力处于极高阶段。请您适当的放松心情，避免长期处于高压之下。压力指数越高，机体的疲劳感越重，容易出现头疼、失眠、肌肉酸痛、心悸怔忡等症状，同时还会伴随精神情绪上的不稳定等现象。";
    }

    QString regist_conclu;
    if(SDNN_Sate==0 )
    {
        regist_conclu="🌂经检测您的抗压能力处于极弱阶段，说明您对外部环境的变化等压力的承受力严重降低。请及时调整心态，多做运动，培养良好的兴趣爱好。";
    }else if(SDNN_Sate==1)
    {
        regist_conclu="🌂经检测您的抗压能力处于较弱阶段。说明您对外部环境的变化等压力的承受力降低。请及时调整心态，多做运动，培养良好的兴趣爱好。";
    }else if(SDNN_Sate==2)
    {
        regist_conclu="🌂经检测您的抗压能力处于正常阶段。说明您对外部环境的变化等压力的承受力处于一般水平。建议多做一些有氧运动，提高生活兴趣。";
    }
    else if(SDNN_Sate==3)
    {
        regist_conclu="🌂经检测您的抗压能力处于较强阶段。说明您对外部环境的变化等压力的承受力处于较高水平。请您继续保持。";
    }
    else
    {
        regist_conclu="🌂经检测您的抗压能力处于极强阶段。说明您对外部环境的变化等压力的承受力处于极高水平。请您继续保持。";
    }
    QString fatigure_conclu;
    if(LF_State==0)
    {
         fatigure_conclu="🌂经检测您的疲劳指数极高，说明您长期处于高压环境中导致身体出现过度疲劳现象，请您注意调整身心状态，合理运动！";
    }else if(LF_State==1)
    {
         fatigure_conclu="🌂经检测您的疲劳指数较高，说明您长期处于高压环境中导致身体出现过度疲劳现象，请您注意调整身心状态，合理运动进行调节！";
    }else if(LF_State==2)
    {
         fatigure_conclu="🌂经检测您的疲劳指数正常！可能存在中等程度的疲劳。";
    }else if(LF_State==3)
    {
         fatigure_conclu="🌂经检测您的疲劳指数较小！";
    }else if(LF_State==4)
    {
         fatigure_conclu="🌂经检测您的疲劳指数极小！";
    }


    MentalPress_Res=psi_conclu+"\n"+msi_conclu+"\n"+regist_conclu+"\n"+fatigure_conclu;

    QString activity_conclu;
    if(TP_State==0)
    {
        activity_conclu="🌂自主神经系统活性代表自主神经系统功能大小，越高代表机体的调节能力越强。经检测您的活性处于极低水平。";
    }else if(TP_State==1)
    {
        activity_conclu="🌂自主神经系统活性代表自主神经系统功能大小，越高代表机体的调节能力越强。经检测您的活性处于较低水平。";

    }else if(TP_State==2)
    {
        activity_conclu="🌂自主神经系统活性代表自主神经系统功能大小，越高代表机体的调节能力越强。经检测您的活性处于正常水平。";
    }else if(TP_State==3)
    {
        activity_conclu="🌂自主神经系统活性代表自主神经系统功能大小，越高代表机体的调节能力越强。经检测您的活性处于较好水平。";
    }else if(TP_State==4)
    {
        activity_conclu="🌂自主神经系统活性代表自主神经系统功能大小，越高代表机体的调节能力越强。经检测您的活性处于极好水平。";
    }

    QString ballance_conclu;
    if(Ans_State==0){
        ballance_conclu="🌂自主神经系统平衡性代表交感神经和迷走神经的均衡状态。经检测您的自主神经系统处于极不平衡状态。";
    }else if(Ans_State==1){
        ballance_conclu="🌂自主神经系统平衡性代表交感神经和迷走神经的均衡状态。经检测您的自主神经系统处于不平衡状态。";
    }else if(Ans_State==2){
        ballance_conclu="🌂自主神经系统平衡性代表交感神经和迷走神经的均衡状态。经检测您的自主神经系统处于平衡状态。";
    }

    QString heart_conclu;
    if(HF_State==0)
    {
        heart_conclu="🌂心脏稳定性可评价长期的精神压力导致心脏健康问题。越小发生心脏病的风险越高。经检测您的心脏稳定性处于极差状态。";
    }else if(HF_State==1)
    {
        heart_conclu="🌂心脏稳定性可评价长期的精神压力导致心脏健康问题。越小发生心脏病的风险越高。经检测您的心脏稳定性处于较差状态。";
    }else if(HF_State==2)
    {
        heart_conclu="🌂心脏稳定性可评价长期的精神压力导致心脏健康问题。越小发生心脏病的风险越高。经检测您的心脏稳定性处于正常状态。";
    }else if(HF_State==3)
    {
        heart_conclu="🌂心脏稳定性可评价长期的精神压力导致心脏健康问题。越小发生心脏病的风险越高。经检测您的心脏稳定性处于较好状态。";
    }else
    {
        heart_conclu="🌂心脏稳定性可评价长期的精神压力导致心脏健康问题。越小发生心脏病的风险越高。经检测您的心脏稳定性处于极好状态。";
    }

    QString emotion_conclu;
    if(EmotionScore<33.33)
    {
         emotion_conclu="🌂处于情绪消极状态,请您注意调节！亦可找朋友倾诉，避免长期的消极情绪导致消极思维、悲观、自责和自卑等的产生。";
    }else if(EmotionScore>66.66)
    {
         emotion_conclu="🌂处于情绪焦虑状态,请您注意调节！焦虑会产生恐惧、紧张、不安等负面情绪。因过度兴奋、焦虑、精神紧张等可发生入睡困难、睡眠质量下降以及睡眠时间减少、记忆力和注意力下降等表现。";
    }else
    {
         emotion_conclu="🌂处于情绪正常状态，请您继续保持！";
    }

    Ans_Res=activity_conclu+"\n\n"+ballance_conclu+"\n\n"+heart_conclu+"\n\n"+emotion_conclu;


}
double HRVDataProcess::Cal_TpScore(double tp, int age,int gender)
{
    double v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, result;
    double v53 = log(tp);
    int v5 = age;

    if (age >= 5)
    {
         if (age > 80)
            v5 = 80;
    }
    else
    {
         v5 = 5;
    }
    v5 -= 5;
    v6 = 0.0;
    v23 = 0.0;
    v7 = 0.0;
    v22 = 0.0;
    v8 = 0.0;
    v21 = 0.0;
    v9 = 0.0;
    if (gender)
    {
         v7 = HrvParameters[10 * v5 + 10830];
         v8 = HrvParameters[10 * v5 + 10832];
         v9 = HrvParameters[10 * v5 + 10836];
         v6 = HrvParameters[10 * v5 + 10838];
    }
    else {
         v7 = HrvParameters[10 * v5 + 9630];
         v8 = HrvParameters[10 * v5 + 9632];
         v9 = HrvParameters[10 * v5 + 9636];
         v6 = HrvParameters[10 * v5 + 9638];
    }

    v21 = v6;
    v22 = v9;
    v23 = v8;
    v10 = fabs(v9 - v23);
    v11 = fabs(v6 - v22);
    v12 = fabs(v8 - v7);
    v20 = v12;
    if (v10 <= v11)
         v10 = v11;
    if (v12 <= v10)
    {
         v12 = v10;
         v20 = v10;
    }
    v13 = v7 - v12;
    if (v7 - v12 < 0.0)
         v13 = 0.0;
    //if ( v5 > 20)
    v14 = (double)(int)(v53 * 10.0 + 0.5) / 10.0;
    //else
    //	v14 = (double)(int)(v53 * 100.0 + 0.5) / 100.0;
    if (v13 <= v14)
    {
         if (v7 <= v14)
         {
            if (v23 <= v14)
            {
                if (v22 <= v14)
                {
                    if (v21 <= v14)
                    {
                        v15 = v21;
                        v16 = v21 + v20;
                        v17 = 80.0;
                        if (v21 + v20 <= v14)
                            v14 = v21 + v20;
                    }
                    else
                    {
                        v16 = v21;
                        v15 = v22;
                        v17 = 60.0;
                    }
                }
                else
                {
                    v15 = v23;
                    v16 = v22;
                    v17 = 40.0;
                }
            }
            else
            {
                v16 = v23;
                v15 = v7;
                v17 = 20.0;
            }
         }
         else
         {
            v15 = v13;
            v16 = v7;
            v17 = 0.0;
         }
    }
    else
    {
         v15 = v13;
         v16 = v7;
         v14 = v13;
         v17 = 0.0;
    }
    v18 = v14 - v15;
    if (v18 == 0.0)
         result = v17;
    else
         result = v18 / (v16 - v15) * 20.0 + v17;

    TP_State = (int)(result / 20.0);
    if (TP_State > 4)
         TP_State = 4;
    if (TP_State < 0)
         TP_State = 0;

    if (result > 98.0)
         result = 98.0;
    if (result < 2)
         result = 2.0;
    return result;

}
double HRVDataProcess::Cal_MsiScore(double ratio, int age,int gender)
{
    int v5; // edx
    double v6; // xmm2_8
    double v7; // xmm7_8
    double v8; // xmm0_8
    double v9; // xmm1_8
    double v10; // xmm1_8
    double v11; // xmm2_8
    double v12; // xmm6_8
    double v13; // xmm2_8
    double v14; // xmm0_8
    double v15; // xmm5_8
    double v16; // xmm3_8
    double v17; // xmm1_8
    double v18; // xmm0_8
    double result; // st7
    double v20; // [esp+4h] [ebp-20h]
    double v21; // [esp+Ch] [ebp-18h]
    double v22; // [esp+14h] [ebp-10h]
    double v23; // [esp+1Ch] [ebp-8h]


    v5 = age;
    if (age >= 5)
    {
         if (age > 80)
            v5 = 80;
    }
    else
    {
         v5 = 5;
    }

    v5 -= 5;
    v6 = 0.0;
    v23 = 0.0;
    v7 = 0.0;
    v22 = 0.0;
    v8 = 0.0;
    v21 = 0.0;
    v9 = 0.0;

    if (gender)
    {
         v7 = HrvParameters[10 * v5 + 8430];
         v8 = HrvParameters[10 * v5 + 8432];
         v9 = HrvParameters[10 * v5 + 8436];
         v6 = HrvParameters[10 * v5 + 8438];
    }
    else
    {//男
         v7 = HrvParameters[10 * v5 + 7230];
         v8 = HrvParameters[10 * v5 + 7232];
         v9 = HrvParameters[10 * v5 + 7236];
         v6 = HrvParameters[10 * v5 + 7238];
    }

    v21 = v6;
    v22 = v9;
    v23 = v8;
    v10 = fabs(v9 - v23);
    v11 = fabs(v6 - v22);
    v12 = fabs(v8 - v7);
    v20 = v12;
    if (v10 <= v11)
         v10 = v11;
    if (v12 <= v10)
    {
         v12 = v10;
         v20 = v10;
    }
    v13 = v7 - v12;
    if (v7 - v12 < 0.0)
         v13 = 0.0;

    v14 = (double)(int)(ratio * 10.0 + 0.5) / 10.0;

    if (v13 <= v14)
    {
         if (v7 <= v14)
         {
            if (v23 <= v14)
            {
                if (v22 <= v14)
                {
                    if (v21 <= v14)
                    {
                        v15 = v21;
                        v16 = v21 + v20;
                        v17 = 80.0;
                        if (v21 + v20 <= v14)
                            v14 = v21 + v20;
                    }
                    else
                    {
                        v16 = v21;
                        v15 = v22;
                        v17 = 60.0;
                    }
                }
                else
                {
                    v15 = v23;
                    v16 = v22;
                    v17 = 40.0;
                }
            }
            else
            {
                v16 = v23;
                v15 = v7;
                v17 = 20.0;
            }
         }
         else
         {
            v15 = v13;
            v16 = v7;
            v17 = 0.0;
         }
    }
    else
    {
         v15 = v13;
         v16 = v7;
         v14 = v13;
         v17 = 0.0;
    }
    v18 = v14 - v15;
    if (v18 == 0.0)
         result = v17;
    else
         result = v18 / (v16 - v15) * 20.0 + v17;

    MSI_State = (int)(result / 20.0);
    if (MSI_State > 4)
         MSI_State = 4;
    if (MSI_State < 0)
         MSI_State = 0;

    if (result > 98.0)
         result = 98.0;
    if (result < 2)
         result = 2.0;


    return result;
}
double HRVDataProcess::CalSdnnScore(double sdnn, int age,int gender)
{
    int v5; // ecx
    double v6; // xmm3_8
    double v7; // xmm6_8
    double v8; // xmm7_8
    double v9; // xmm4_8
    double v10; // xmm1_8
    double v11; // xmm0_8
    double v12; // xmm0_8
    double v13; // xmm2_8
    double v14; // xmm1_8
    double v15; // xmm0_8
    double v16; // xmm1_8
    double v17; // xmm0_8
    double result; // st7
    double v19; // [esp+28h] [ebp-28h]
    double v20; // [esp+30h] [ebp-20h]
    double v21; // [esp+38h] [ebp-18h]
    double v22; // [esp+40h] [ebp-10h]
    double v23; // [esp+48h] [ebp-8h]


    v5 = age;
    v20 = 0.0;
    v6 = 0.0;
    v22 = 0.0;
    v7 = 0.0;
    v23 = 0.0;
    v8 = 0.0;
    v21 = 0.0;
    v9 = 0.0;
    if (age >= 5)
    {
         if (age > 80)
            v5 = 80;
    }
    else
    {
         v5 = 5;
    }
    v5 -= 5;

    if (gender)
    {

         v6 = HrvParameters[10 * v5 + 3630];
         v8 = HrvParameters[10 * v5 + 3632];
         v9 = HrvParameters[10 * v5 + 3636];
         v7 = HrvParameters[10 * v5 + 3638];
    }
    else
    {
         v6 = HrvParameters[10 * v5 + 2430];
         v8 = HrvParameters[10 * v5 + 2432];
         v9 = HrvParameters[10 * v5 + 2436];
         v7 = HrvParameters[10 * v5 + 2438];
    }



    v21 = v7;
    v23 = v9;
    v20 = v8;
    v22 = v6;
    v10 = fabs(v6 - 0.0);
    v11 = fabs(v8 - v6);
    if (v10 <= v11)
         v10 = v11;
    v12 = fabs(v9 - v8);
    v13 = fabs(v7 - v9);
    if (v12 <= v13)
         v12 = v13;
    if (v10 <= v12)
         v10 = v12;
    v19 = v6 - v10;
    if (v6 - v10 < 0.0)
         v19 = 0.0;
    v14 = v10 + v7;

    v6 = v22;
    v7 = v21;
    v8 = v20;
    v9 = v23;
    v15 = floor(sdnn + 0.5);

    if (v19 <= v15)
    {
         if (v6 <= v15)
         {
            if (v8 <= v15)
            {
                if (v9 <= v15)
                {
                    if (v7 <= v15)
                    {
                        v6 = v14;
                        if (v14 <= v15)
                        {
                            v15 = v14;
                            v16 = 100.0;
                            v9 = v7;
                        }
                        else
                        {
                            v9 = v7;
                            v16 = 80.0;
                        }
                    }
                    else
                    {
                        v16 = 60.0;
                        v6 = v7;
                    }
                }
                else
                {
                    v6 = v23;
                    v9 = v8;
                    v16 = 40.0;
                }
            }
            else
            {
                v9 = v6;
                v6 = v8;
                v16 = 20.0;
            }
         }
         else
         {
            v9 = v19;
            v16 = 0.0;
         }
    }
    else
    {
         v9 = v19;
         v15 = v19;
         v16 = 0.0;
    }
    v17 = v15 - v9;
    if (v17 == 0.0)
         result = v16;
    else
         result = v17 / (v6 - v9) * 20.0 + v16;

    SDNN_Sate = (int)(result / 20.0);
    if (SDNN_Sate > 4)
         SDNN_Sate = 4;
    if (SDNN_Sate < 0)
         SDNN_Sate = 0;

    if (result > 98.0)
         result = 98.0;
    if (result < 2)
         result = 2.0;

    return result;
}
double HRVDataProcess::CalPsiScore(double psi, int age,int gender)
{
    int v5; // edx
    double v6; // xmm5_8
    double v7; // xmm7_8
    double v8; // xmm6_8
    double v9; // xmm1_8
    double v10; // xmm1_8
    double v11; // xmm4_8
    double v12; // xmm2_8
    double v13; // xmm2_8
    double v14; // xmm0_8
    double v15; // xmm1_8
    double v16; // xmm5_8
    double v17; // xmm0_8
    double result; // st7
    double v19; // [esp+10h] [ebp-28h]
    double v20; // [esp+18h] [ebp-20h]
    double v21; // [esp+20h] [ebp-18h]
    double v22; // [esp+28h] [ebp-10h]
    double v23; // [esp+30h] [ebp-8h]


    v5 = age;
    if (age >= 5)
    {
         if (age > 80)
            v5 = 80;
    }
    else
    {
         v5 = 5;
    }

    v5 -= 5;
    v6 = 0.0;
    v20 = 0.0;
    v7 = 0.0;
    v22 = 0.0;
    v8 = 0.0;
    v23 = 0.0;
    v9 = 0.0;
    v21 = 0.0;

    if (gender)
    {
         v6 = HrvParameters[10 * v5 + 6030];
         v8 = HrvParameters[10 * v5 + 6032];
         v9 = HrvParameters[10 * v5 + 6036];
         v7 = HrvParameters[10 * v5 + 6038];
    }
    else
    {
         v6 = HrvParameters[10 * v5 + 4830];
         v8 = HrvParameters[10 * v5 + 4832];
         v9 = HrvParameters[10 * v5 + 4836];
         v7 = HrvParameters[10 * v5 + 4838];
    }
    v21 = v7;
    v23 = v9;
    v22 = v8;
    v20 = v6;
    v10 = fabs(v9 - v8);
    v11 = fabs(v7 - v23);
    v12 = fabs(v8 - v6);
    if (v10 <= v11)
         v10 = v11;
    if (v12 <= v10)
         v12 = v10;
    v19 = v6 - v12;
    if (v6 - v12 < 0.0)
         v19 = 0.0;
    v13 = v12 + v7;
    v7 = v21;
    v8 = v22;
    v14 = floor(psi + 0.5);
    v15 = 0.0;
    v16 = v20;
    if (v19 <= v14)
    {
         if (v20 <= v14)
         {
            if (v8 <= v14)
            {
                if (v23 <= v14)
                {
                    if (v7 <= v14)
                    {
                        v15 = 80.0;
                        v8 = v7;
                        v16 = v13;
                        if (v13 <= v14)
                            v14 = v13;
                    }
                    else
                    {
                        v15 = 60.0;
                        v8 = v23;
                        v16 = v7;
                    }
                }
                else
                {
                    v15 = 40.0;
                    v16 = v23;
                }
            }
            else
            {
                v8 = v20;
                v16 = v22;
                v15 = 20.0;
            }
         }
         else
         {
            v8 = v19;
            v15 = 0.0;
         }
    }
    else
    {
         v8 = v19;
         v14 = v19;
    }
    v17 = v14 - v8;
    if (v17 == 0.0)
         result = v15;
    else
         result = v17 / (v16 - v8) * 20.0 + v15;
    PSI_State = (int)(result / 20.0);
    if (PSI_State > 4)
         PSI_State = 4;
    if (PSI_State < 0)
         PSI_State = 0;

    if (result > 98.0)
         result = 98.0;
    if (result < 2)
         result = 2.0;

    return result;
}
double HRVDataProcess::CalLfScore(double lf, int age,int gender)
{
    double lf_temp = log(lf);

    int v5; // edx
    double v6; // xmm2_8
    double v7; // xmm7_8
    double v8; // xmm0_8
    double v9; // xmm1_8
    double v10; // xmm1_8
    double v11; // xmm2_8
    double v12; // xmm6_8
    double v13; // xmm2_8
    double v14; // xmm0_8
    double v15; // xmm5_8
    double v16; // xmm3_8
    double v17; // xmm1_8
    double v18; // xmm0_8
    double result; // st7
    double v20; // [esp+4h] [ebp-20h]
    double v21; // [esp+Ch] [ebp-18h]
    double v22; // [esp+14h] [ebp-10h]
    double v23; // [esp+1Ch] [ebp-8h]


    v5 = age;
    if (age >= 5)
    {
         if (age > 80)
            v5 = 80;
    }
    else
    {
         v5 = 5;
    }

    v5 -= 5;
    v6 = 0.0;
    v23 = 0.0;
    v7 = 0.0;
    v22 = 0.0;
    v8 = 0.0;
    v21 = 0.0;
    v9 = 0.0;

    if (gender)
    {

         v7 = HrvParameters[10 * v5 + 15630];
         v8 = HrvParameters[10 * v5 + 15632];
         v9 = HrvParameters[10 * v5 + 15636];
         v6 = HrvParameters[10 * v5 + 15638];
    }
    else
    {
         v7 = HrvParameters[10 * v5 + 14430];
         v8 = HrvParameters[10 * v5 + 14432];
         v9 = HrvParameters[10 * v5 + 14436];
         v6 = HrvParameters[10 * v5 + 14438];
    }

    v21 = v6;
    v22 = v9;
    v23 = v8;
    v10 = fabs(v9 - v23);
    v11 = fabs(v6 - v22);
    v12 = fabs(v8 - v7);
    v20 = v12;
    if (v10 <= v11)
         v10 = v11;
    if (v12 <= v10)
    {
         v12 = v10;
         v20 = v10;
    }
    v13 = v7 - v12;
    if (v7 - v12 < 0.0)
         v13 = 0.0;

    v14 = (double)(int)(lf_temp * 10.0 + 0.5) / 10.0;

    if (v13 <= v14)
    {
         if (v7 <= v14)
         {
            if (v23 <= v14)
            {
                if (v22 <= v14)
                {
                    if (v21 <= v14)
                    {
                        v15 = v21;
                        v16 = v21 + v20;
                        v17 = 80.0;
                        if (v21 + v20 <= v14)
                            v14 = v21 + v20;
                    }
                    else
                    {
                        v16 = v21;
                        v15 = v22;
                        v17 = 60.0;
                    }
                }
                else
                {
                    v15 = v23;
                    v16 = v22;
                    v17 = 40.0;
                }
            }
            else
            {
                v16 = v23;
                v15 = v7;
                v17 = 20.0;
            }
         }
         else
         {
            v15 = v13;
            v16 = v7;
            v17 = 0.0;
         }
    }
    else
    {
         v15 = v13;
         v16 = v7;
         v14 = v13;
         v17 = 0.0;
    }
    v18 = v14 - v15;
    if (v18 == 0.0)
         result = v17;
    else
         result = v18 / (v16 - v15) * 20.0 + v17;

    LF_State = (int)(result / 20.0);                      // lfscore
    if (LF_State > 4)
         LF_State = 4;
    if (LF_State < 0)
         LF_State = 0;

    if (result > 98.0)
         result = 98.0;
    if (result < 2)
         result = 2.0;

    return result;

}
double HRVDataProcess::CalHfScore(double hf, int age,int gender)
{
    double hf_temp = log(hf);

    int v5; // edx
    double v6; // xmm2_8
    double v7; // xmm7_8
    double v8; // xmm0_8
    double v9; // xmm1_8
    double v10; // xmm1_8
    double v11; // xmm2_8
    double v12; // xmm6_8
    double v13; // xmm2_8
    double v14; // xmm0_8
    double v15; // xmm5_8
    double v16; // xmm3_8
    double v17; // xmm1_8
    double v18; // xmm0_8
    double result; // st7
    double v20; // [esp+4h] [ebp-20h]
    double v21; // [esp+Ch] [ebp-18h]
    double v22; // [esp+14h] [ebp-10h]
    double v23; // [esp+1Ch] [ebp-8h]


    v5 = age;
    if (age >= 5)
    {
         if (age > 80)
            v5 = 80;
    }
    else
    {
         v5 = 5;
    }

    v5 -= 5;
    v6 = 0.0;
    v23 = 0.0;
    v7 = 0.0;
    v22 = 0.0;
    v8 = 0.0;
    v21 = 0.0;
    v9 = 0.0;

    if (gender)
    {

         v7 = HrvParameters[10 * v5 + 18030];
         v8 = HrvParameters[10 * v5 + 18032];
         v9 = HrvParameters[10 * v5 + 18036];
         v6 = HrvParameters[10 * v5 + 18038];
    }
    else
    {
         v7 = HrvParameters[10 * v5 + 16830];
         v8 = HrvParameters[10 * v5 + 16832];
         v9 = HrvParameters[10 * v5 + 16836];
         v6 = HrvParameters[10 * v5 + 16838];

    }

    v21 = v6;
    v22 = v9;
    v23 = v8;
    v10 = fabs(v9 - v23);
    v11 = fabs(v6 - v22);
    v12 = fabs(v8 - v7);
    v20 = v12;
    if (v10 <= v11)
         v10 = v11;
    if (v12 <= v10)
    {
         v12 = v10;
         v20 = v10;
    }
    v13 = v7 - v12;
    if (v7 - v12 < 0.0)
         v13 = 0.0;

    v14 = (double)(int)(hf_temp * 10.0 + 0.5) / 10.0;

    if (v13 <= v14)
    {
         if (v7 <= v14)
         {
            if (v23 <= v14)
            {
                if (v22 <= v14)
                {
                    if (v21 <= v14)
                    {
                        v15 = v21;
                        v16 = v21 + v20;
                        v17 = 80.0;
                        if (v21 + v20 <= v14)
                            v14 = v21 + v20;
                    }
                    else
                    {
                        v16 = v21;
                        v15 = v22;
                        v17 = 60.0;
                    }
                }
                else
                {
                    v15 = v23;
                    v16 = v22;
                    v17 = 40.0;
                }
            }
            else
            {
                v16 = v23;
                v15 = v7;
                v17 = 20.0;
            }
         }
         else
         {
            v15 = v13;
            v16 = v7;
            v17 = 0.0;
         }
    }
    else
    {
         v15 = v13;
         v16 = v7;
         v14 = v13;
         v17 = 0.0;
    }
    v18 = v14 - v15;
    if (v18 == 0.0)
         result = v17;
    else
         result = v18 / (v16 - v15) * 20.0 + v17;

    HF_State = (int)(result / 20.0);
    if (HF_State > 4)
         HF_State = 4;
    if (HF_State < 0)
         HF_State = 0;

    if (result > 98.0)
         result = 98.0;
    if (result < 2)
         result = 2.0;

    return result;
}

void HRVDataProcess::CalHrtstate(double mean_hrt, int age, int gender)
{
    int v5; // edx
    double v6; // xmm2_8
    double v7; // xmm6_8
    double v8; // xmm7_8
    double v9; // xmm5_8
    double v10; // xmm1_8
    double v11; // xmm4_8
    double v12; // xmm3_8
    double v13; // xmm3_8
    double v14; // xmm0_8
    double v15; // xmm1_8
    double v16; // xmm3_8
    double v18; // [esp+10h] [ebp-28h]


    v5 = age;
    if (age >= 5)
    {
         if (age > 80)
            v5 = 80;
    }
    else
    {
         v5 = 5;
    }

    v5 -= 5;
    if (gender)
    {
         v6 = HrvParameters[10 * v5 + 1230];
         v7 = HrvParameters[10 * v5 + 1232];
         v8 = HrvParameters[10 * v5 + 1236];
         v9 = HrvParameters[10 * v5 + 1238];
    }
    else
    {
         v6 = HrvParameters[10 * v5 + 30];
         v7 = HrvParameters[10 * v5 + 32];
         v8 = HrvParameters[10 * v5 + 36];
         v9 = HrvParameters[10 * v5 + 38];
    }

    v10 = fabs(v8 - v7);
    v11 = fabs(v9 - v8);
    v12 = fabs(v7 - v6);
    if (v10 <= v11)
         v10 = v11;
    if (v12 <= v10)
         v12 = v10;
    v18 = v6 - v12;
    if (v6 - v12 < 0.0)
         v18 = 0.0;
    v13 = v12 + v9;
    v14 = floor(mean_hrt + 0.5);
    v15 = v18;
    if (v18 <= v14)
    {
         if (v6 > v14)
         {
            v16 = 0.0;
         }
         else if (v7 <= v14)
         {
            if (v8 <= v14)
            {
                if (v9 <= v14)
                {
                    v6 = v13;
                    if (v13 <= v14)
                    {
                        v14 = v13;
                        v16 = 80.0;
                        v15 = v9;
                    }
                    else
                    {
                        v15 = v9;
                        v16 = 80.0;
                    }
                }
                else
                {
                    v16 = 60.0;
                    v15 = v8;
                    v6 = v9;
                }
            }
            else
            {
                v16 = 40.0;
                v15 = v7;
                v6 = v8;
            }
         }
         else
         {
            v16 = 20.0;
            v15 = v6;
            v6 = v7;
         }
    }
    else
    {
         v14 = v18;
         v16 = 0.0;
    }
    double result;
    result = (v14 - v15) / (v6 - v15) * 20.0 + v16;

    HRT_State = (int)(result / 20.0);                      // lfscore
    if (HRT_State > 4)
         HRT_State = 4;
    if (HRT_State < 0)
         HRT_State = 0;

}
double HRVDataProcess::Cal_TotolScore(double psiscore, double sdnnscore, double msiscore)
{
    double result;
    result = 100.0 - ((100.0 - psiscore) * 3.0 + sdnnscore * 6.0 + 100.0 - msiscore) / 10.0;

    return result;

}
double HRVDataProcess::Cal_ANSBalance(double lfnorm, int age, int gender)
{
    int v5; // edx
    double v6; // xmm0_8
    double v7; // xmm2_8
    double v8; // xmm5_8
    double v9; // xmm6_8
    double v10; // xmm4_8
    double v11; // xmm1_8
    double v12; // xmm0_8
    double v13; // xmm1_8
    double v14; // xmm1_8
    double v16; // xmm4_8
    double v17; // xmm1_8
    double v18; // xmm7_8
    double v19; // xmm0_8
    double v20; // [esp+4h] [ebp-8h]
    double v21; // [esp+14h] [ebp+8h]


    v5 = age;
    v6 = 0.0;
    if (age >= 5)
    {
         if (age > 80)
            v5 = 80;
    }
    else
    {
         v5 = 5;
    }

    v5 -= 5;
    v7 = 0.0;
    v20 = 0.0;
    v8 = 0.0;
    v9 = 0.0;
    if (gender)
         v6 = HrvParameters[10 * v5 + 19434];
    else
         v6 = HrvParameters[10 * v5 + 19234];
    if (lfnorm > v6)
    {
         v10 = 100.0;
         if (gender)
         {
            v7 = HrvParameters[10 * v5 + 19434];
            v8 = HrvParameters[10 * v5 + 19436];
            v9 = HrvParameters[10 * v5 + 19438];
         }
         else
         {
            v7 = HrvParameters[10 * v5 + 19234];
            v8 = HrvParameters[10 * v5 + 19236];
            v9 = HrvParameters[10 * v5 + 19238];
         }
         v20 = 100.0;
         v11 = (double)(int)(lfnorm * 10.0 + 0.5) / 10.0;
         if (v7 <= v11)
         {
            if (v8 < v11)
            {
                if (v9 < v11)
                {
                    v7 = v20;
                    if (v11 <= v9 || v20 < v11)
                    {
                        v12 = v20;
                        v10 = 150.0;
                        v7 = v11;
                    }
                    else
                    {
                        v12 = v9;
                    }
                }
                else
                {
                    v12 = v8;
                    v7 = v9;
                    v10 = 50.0;
                }
            }
            else
            {
                v12 = v7;
                v10 = 0.0;
                v7 = v8;
            }
         }
         else
         {
            v12 = v11;
            v10 = 0.0;
         }
         v13 = v11 - v12;
         if (v13 == 0.0)
            v14 = v10;
         else
            v14 = v13 / (v7 - v12) * 50.0 + v10;
         if (v14 >= 150.0)
            return 150.0 + 200.0;
         if (v14 <= 0.0)
            v14 = 0.0;
         return v14 + 200.0;
    }
    if (gender)
    {
         v7 = HrvParameters[10 * v5 + 20434];
         v8 = HrvParameters[10 * v5 + 20432];
         v9 = HrvParameters[10 * v5 + 20430];
    }
    else
    {
         v7 = HrvParameters[10 * v5 + 19234];
         v8 = HrvParameters[10 * v5 + 19232];
         v9 = HrvParameters[10 * v5 + 19230];
    }
    v16 = 100.0;


    v17 = (double)(int)(lfnorm * 10.0 + 0.5) / 10.0;
    if (v17 <= v7)
    {
         if (v17 > v8)
         {
            v18 = v8;
            v16 = 0.0;
            goto LABEL_55;
         }
         if (v17 >= v9)
         {
            v16 = 50.0;
            v7 = v8;
            v18 = v9;
            goto LABEL_55;
         }
         if (v17 >= 0.0)
         {
            v18 = 0.0;
            v7 = v9;
            goto LABEL_55;
         }
         v7 = 0.0;
         v16 = 150.0;
    }
    else
    {
         v16 = 0.0;
    }
    v18 = v17;
LABEL_55:
    if (v7 - v17 == 0.0)
         v19 = v16;
    else
         v19 = (v7 - v17) / (v7 - v18) * 50.0 + v16;
    v21 = v19;
    if (v19 >= 150.0)
         return 150.0;
    if (v19 <= 0.0)
         v21 = 0.0;

    if (v21 >= 200.0)
         v21 -= 200;

    return v21;
}
double HRVDataProcess::Cacul_Emotion(double lfhf)
{
    double res;
    if(lfhf<=0.6666)
    {
        //迷走神经兴奋
        res = 100 * lfhf / 2;
    }else if(lfhf>=1.5)
    {
        //交感神经兴奋
        if (lfhf > 11.5)
            lfhf = 11.5;
        res = 100*(0.03 * lfhf + 0.655);
    }else
    {
        res = 100*(4 * lfhf + 0.3) / 9;
    }
    return res;
}
double HRVDataProcess::Cal_ANSBalanceState(double ans_lance, int age)
{
    double v3; // xmm2_8
    int result; // eax
    bool v5; // cc
    int a2, a3;

    if (age < 20)
        a2 = 2;
    else
        a2 = 1;
    a3 = 9;
    if (a2 == 1)
    {
        v3 = (double)(int)(ans_lance * 10.0 + 0.5) / 10.0;
    }
    else if (a2 == 2)
    {
        v3 = (double)(int)(ans_lance * 100.0 + 0.5) / 100.0;
    }
    else
    {
        v3 = floor(ans_lance + 0.5);
    }
    switch (a3)
    {
    case 9:
        if (v3 <= 100.0)
        {
            if (v3 > 50.0)
                return 1;
            return 2;
        }
        return 0;
    case 3:
    case 4:
        if (v3 > 130.0)
            return 0;
        if (v3 > 110.0)
            return 1;
        if (v3 <= 90.0)
        {
            v5 = v3 <= 70.0;
            goto LABEL_33;
        }
        return 2;
    case 5:
        if (v3 < 20.0)
            return 0;
        if (v3 < 40.0)
            return 1;
        if (v3 < 60.0)
            return 2;
        v5 = v3 >= 80.0;
    LABEL_33:
        result = 3;
        if (!v5)
            return result;
        return 4;
    }
    if (a3 != 7)
    {
        if (a3 == 8)
            return v3 <= 100.0;
        if (v3 < 70.0)
            return 0;
        if (v3 < 90.0)
            return 1;
        if (v3 >= 110.0)
        {
            v5 = v3 >= 130.0;
            goto LABEL_33;
        }
        return 2;
    }
    if (v3 <= 100.0)
    {
        if (v3 > 50.0)
            return 3;
        return 2;
    }
    return 4;
}

HRVIndex HRVDataProcess::getHRVIndex()
{
    HRVIndex hi;
    hi.time.RR_mean=MeanNN;
    hi.time.RR_SDNN=Sdnn;
    hi.time.RR_RMSSD=Rmssd;
    hi.time.RR_CV=CV;
    hi.time.NN50=NN50;
    hi.time.pNN50=pNN50;
    hi.time.RR_DRR=DRR;
    hi.time.SDSD=SDSD;

    hi.time.ApEn=Apen;
    hi.time.Psi=Psi;
    hi.freq.TP=TP;
    hi.freq.VLF=VLF;
    hi.freq.LF=LF;
    hi.freq.HF=HF;
    hi.freq.LFnorm=LFNorm;
    hi.freq.HFnorm=HFNorm;
    hi.freq.LFHF=LFHFRatio;
    hi.sl.AbnormalHeartNum=rr_abnormal_count;
    hi.sl.MaxHrt=MaxHrt;
    hi.sl.MinHrt=MinHrt;
    hi.sl.MeanHrt=MeanHrt;
    hi.sl.Perfusion=this->perfusion;
    hi.sl.ox=this->Spox;
    hi.time.RR=rr;


    hi.mp.TP_State= TP_State;
    qDebug()<<"hi.mp.TP_State= TP_State"<<TP_State;
    hi.mp.MSI_State = MSI_State;
    hi.mp.PSI_State = PSI_State;
    hi.mp.SDNN_Sate = SDNN_Sate;
    hi.mp.LF_State = LF_State;
    hi.mp.HF_State = HF_State;
    hi.mp.HRT_State = HRT_State;
    hi.mp.tpScore = tpScore;
    hi.mp.MsiScore = MsiScore;
    hi.mp.SdnnScore = SdnnScore;
    hi.mp.PsiScore = PsiScore;
    hi.mp.lfScore = lfScore;
    hi.mp.hfScore = hfScore;
    hi.mp.AnsScore = AnsScore ;
    hi.mp.Ans_State = Ans_State;
    hi.mp.TotalScore  = TotalScore;
    hi.mp.EmotionScore = EmotionScore;
    hi.MentalPressureResults=MentalPress_Res;
    hi.SLResults=SL_Res;
    hi.AnsResults=Ans_Res;
    hi.HRVResults=HRV_Res;

    for(int i=0;i<128;i++)
    {
        hi.freq.freq.append(f[i]);
        hi.freq.psd.append(dst[i]);
    }
    return hi;
}
void HRVDataProcess::getSLIndex(QList<int>rr,QList<double>spox,QList<double>perfustion)
{
    ListOperation lo;
    this->rr=rr;
    this->Spox=lo.getMeanValue(spox);
    this->perfusion=lo.getMeanValue(perfustion);
}

QString HRVDataProcess::HRVData2Json(HRVIndex hi,QList<double>sub_ppg,UserInfoBeab uib)
{
    QJsonObject jsonObject;
    QJsonArray jsonArray_SL,jsonArray_Time,jsonArray_RR,jsonArray_Freq,jsonArray_MentalPress;
    QJsonArray jsonArray_f,jsonArray_psd;
    QJsonArray jsonArray_presentPPG,jsonArray_presentAPPG;
    QJsonArray jsonArray_ABCDE,jsonArray_SevenState;
    QJsonArray jsonArray_VascularIndex;

    jsonArray_SL.append(hi.sl.MeanHrt);

    jsonArray_SL.append(hi.sl.MaxHrt);
    jsonArray_SL.append(hi.sl.MinHrt);
    jsonArray_SL.append(hi.sl.AbnormalHeartNum);
    jsonArray_SL.append(hi.sl.ox);
    jsonArray_SL.append(hi.sl.Perfusion);
    jsonObject.insert("jsonArray_SL",jsonArray_SL);

    jsonArray_Time.append(hi.time.RR_mean);
    jsonArray_Time.append(hi.time.RR_RMSSD);
    jsonArray_Time.append(hi.time.RR_SDNN);
    jsonArray_Time.append(hi.time.ApEn);
    jsonArray_Time.append(hi.time.Psi);
    jsonArray_Time.append(hi.time.NN50);
    jsonArray_Time.append(hi.time.pNN50);
    jsonArray_Time.append(hi.time.RR_CV);
    jsonArray_Time.append(hi.time.SDSD);
    jsonArray_Time.append(hi.time.RR_DRR);
    jsonObject.insert("jsonArray_Time",jsonArray_Time);
    int rr_len=hi.time.RR.size();
    for(int i=0;i<rr_len;i++)
    {
        jsonArray_RR.append(hi.time.RR.at(i));
    }
    jsonObject.insert("jsonArray_RR",jsonArray_RR);

    jsonArray_Freq.append(hi.freq.TP);
    jsonArray_Freq.append(hi.freq.VLF);
    jsonArray_Freq.append(hi.freq.LF);
    jsonArray_Freq.append(hi.freq.HF);
    jsonArray_Freq.append(hi.freq.LFnorm);
    jsonArray_Freq.append(hi.freq.HFnorm);
    jsonArray_Freq.append(hi.freq.LFHF);
    jsonObject.insert("jsonArray_Freq",jsonArray_Freq);

    for(int i=0;i<128;i++)
    {
        jsonArray_f.append(hi.freq.freq.at(i));
        jsonArray_psd.append(hi.freq.psd.at(i));
    }
    jsonObject.insert("jsonArray_f",jsonArray_f);
    jsonObject.insert("jsonArray_psd",jsonArray_psd);




    jsonArray_MentalPress.append(hi.mp.TP_State);
    jsonArray_MentalPress.append(hi.mp.MSI_State);
    jsonArray_MentalPress.append(hi.mp.PSI_State);
    jsonArray_MentalPress.append(hi.mp.SDNN_Sate);
    jsonArray_MentalPress.append(hi.mp.LF_State);
    jsonArray_MentalPress.append(hi.mp.HF_State);
    jsonArray_MentalPress.append(hi.mp.HRT_State);

    jsonArray_MentalPress.append(hi.mp.tpScore);
    jsonArray_MentalPress.append(hi.mp.MsiScore);
    jsonArray_MentalPress.append(hi.mp.SdnnScore);
    jsonArray_MentalPress.append(hi.mp.PsiScore);
    jsonArray_MentalPress.append(hi.mp.lfScore);
    jsonArray_MentalPress.append(hi.mp.hfScore);
    jsonArray_MentalPress.append(hi.mp.AnsScore);
    jsonArray_MentalPress.append(hi.mp.Ans_State);
    jsonArray_MentalPress.append(hi.mp.TotalScore);
    jsonArray_MentalPress.append(hi.mp.EmotionScore);
    jsonObject.insert("jsonArray_MentalPress",jsonArray_MentalPress);
    jsonObject.insert("SL_Res",hi.SLResults);
    jsonObject.insert("mentalPressure_Res",hi.MentalPressureResults);
    jsonObject.insert("ans_Res",hi.AnsResults);
    jsonObject.insert("hrv_Res",hi.HRVResults);


    appgalg->computePrensentPPG_APPG(sub_ppg);
    appgalg->computeAccIndex(age);

    for(int i=0;i<appgalg->ActualLen;i++)
    {
        jsonArray_presentAPPG.append(appgalg->Present_appg.at(i));
        jsonArray_presentPPG.append(appgalg->Present_ppg.at(i));
    }

    for(int i=0;i<5;i++)
    {
        jsonArray_ABCDE.append(appgalg->abcde.at(i));
    }
    for(int i=0;i<7;i++)
    {
        jsonArray_SevenState.append(appgalg->SevenState.at(i));
    }

    jsonArray_VascularIndex.append(appgalg->VascularState);
    jsonArray_VascularIndex.append(appgalg->DPI);
    jsonArray_VascularIndex.append(appgalg->SP);
    jsonArray_VascularIndex.append(appgalg->BVT);
    jsonArray_VascularIndex.append(appgalg->RBV);
    jsonArray_VascularIndex.append(appgalg->VascularAge);
    jsonArray_VascularIndex.append(appgalg->K);


    jsonObject.insert("jsonArray_presentAPPG",jsonArray_presentAPPG);

    jsonObject.insert("jsonArray_presentPPG",jsonArray_presentPPG);

    jsonObject.insert("jsonArray_SevenState",jsonArray_SevenState);

    jsonObject.insert("jsonArray_ABCDE",jsonArray_ABCDE);

    jsonObject.insert("Vasular_res",appgalg->res);

    jsonObject.insert("jsonArray_VascularIndex",jsonArray_VascularIndex);

    jsonObject.insert("UserID",uib.UserID);
    jsonObject.insert("UserName",uib.UserName);
    jsonObject.insert("UserAge",uib.UserAge);
    jsonObject.insert("UserSex",uib.UserSex);

    return QString(QJsonDocument(jsonObject).toJson());

}
HRVIndex HRVDataProcess::Json2HRVData(QString json)
{
    QJsonArray jsonArray_SL,jsonArray_Time,jsonArray_RR,jsonArray_Freq,jsonArray_MentalPress;
    QJsonArray jsonArray_f,jsonArray_psd;
    QJsonDocument jsonDoc = QJsonDocument::fromJson(json.toUtf8());
    QJsonObject job=jsonDoc.object();
    HRVIndex hi;
    if(job.contains("jsonArray_SL")&& job.value("jsonArray_SL").isArray())
    {
        jsonArray_SL=job.value("jsonArray_SL").toArray();
        hi.sl.MeanHrt=jsonArray_SL.at(0).toInt();
        hi.sl.MaxHrt=jsonArray_SL.at(1).toInt();
        hi.sl.MinHrt=jsonArray_SL.at(2).toInt();
        hi.sl.AbnormalHeartNum=jsonArray_SL.at(3).toInt();
        hi.sl.ox=jsonArray_SL.at(4).toDouble();
        hi.sl.Perfusion=jsonArray_SL.at(5).toDouble();
    }
    if(job.contains("jsonArray_Time")&& job.value("jsonArray_Time").isArray())
    {
        jsonArray_Time=job.value("jsonArray_Time").toArray();
        hi.time.RR_mean=jsonArray_Time.at(0).toDouble();
        hi.time.RR_RMSSD=jsonArray_Time.at(1).toDouble();
        hi.time.RR_SDNN=jsonArray_Time.at(2).toDouble();
        hi.time.ApEn=jsonArray_Time.at(3).toDouble();
        hi.time.Psi=jsonArray_Time.at(4).toDouble();
        hi.time.NN50=jsonArray_Time.at(5).toDouble();
        hi.time.pNN50=jsonArray_Time.at(6).toDouble();
        hi.time.RR_CV=jsonArray_Time.at(7).toDouble();
        hi.time.SDSD=jsonArray_Time.at(8).toDouble();
        hi.time.RR_DRR=jsonArray_Time.at(9).toDouble();
    }

    if(job.contains("jsonArray_RR")&& job.value("jsonArray_RR").isArray())
    {
        jsonArray_RR=job.value("jsonArray_RR").toArray();
        int rr_len=jsonArray_RR.size();
        for(int i=0;i<rr_len;i++)
        {
            hi.time.RR.append(jsonArray_RR.at(i).toInt());
        }
    }
    if(job.contains("jsonArray_Freq")&& job.value("jsonArray_Freq").isArray())
    {
        jsonArray_Freq=job.value("jsonArray_Freq").toArray();
        hi.freq.TP=jsonArray_Freq.at(0).toDouble();
        hi.freq.VLF=jsonArray_Freq.at(1).toDouble();
        hi.freq.LF=jsonArray_Freq.at(2).toDouble();
        hi.freq.HF=jsonArray_Freq.at(3).toDouble();
        hi.freq.LFnorm=jsonArray_Freq.at(4).toDouble();
        hi.freq.HFnorm=jsonArray_Freq.at(5).toDouble();
        hi.freq.LFHF=jsonArray_Freq.at(6).toDouble();
    }

    if(job.contains("jsonArray_psd") && job.value("jsonArray_psd").isArray())
    {
        jsonArray_psd=job.value("jsonArray_psd").toArray();
        for(int i=0;i<128;i++)
        {
            hi.freq.psd.append(jsonArray_psd.at(i).toDouble());
        }
    }

    if(job.contains("jsonArray_f") && job.value("jsonArray_f").isArray())
    {
        jsonArray_f=job.value("jsonArray_f").toArray();
        for(int i=0;i<128;i++)
        {
            hi.freq.freq.append(jsonArray_f.at(i).toDouble());
        }
    }

    if(job.contains("jsonArray_MentalPress") && job.value("jsonArray_MentalPress").isArray())
    {
        jsonArray_MentalPress=job.value("jsonArray_MentalPress").toArray();
        hi.mp.TP_State=jsonArray_MentalPress.at(0).toInt();
        hi.mp.MSI_State=jsonArray_MentalPress.at(1).toInt();
        hi.mp.PSI_State=jsonArray_MentalPress.at(2).toInt();
        hi.mp.SDNN_Sate=jsonArray_MentalPress.at(3).toInt();
        hi.mp.LF_State=jsonArray_MentalPress.at(4).toInt();
        hi.mp.HF_State=jsonArray_MentalPress.at(5).toInt();
        hi.mp.HRT_State=jsonArray_MentalPress.at(6).toInt();

        hi.mp.tpScore=jsonArray_MentalPress.at(7).toDouble();
        hi.mp.MsiScore=jsonArray_MentalPress.at(8).toDouble();
        hi.mp.SdnnScore=jsonArray_MentalPress.at(9).toDouble();
        hi.mp.PsiScore=jsonArray_MentalPress.at(10).toDouble();
        hi.mp.lfScore=jsonArray_MentalPress.at(11).toDouble();
        hi.mp.hfScore=jsonArray_MentalPress.at(12).toDouble();
        hi.mp.AnsScore=jsonArray_MentalPress.at(13).toDouble();
        hi.mp.Ans_State=jsonArray_MentalPress.at(14).toDouble();
        hi.mp.TotalScore=jsonArray_MentalPress.at(15).toDouble();
        hi.mp.EmotionScore=jsonArray_MentalPress.at(16).toDouble();
    }

    if(job.contains("SL_Res"))
    {
        hi.SLResults=job.value("SL_Res").toString();
    }
    if(job.contains("mentalPressure_Res"))
        hi.MentalPressureResults=job.value("mentalPressure_Res").toString();
    if(job.contains("ans_Res"))
        hi.AnsResults=job.value("ans_Res").toString();
    if(job.contains("hrv_Res"))
        hi.HRVResults=job.value("hrv_Res").toString();


    QJsonArray jsonArray_presentPPG,jsonArray_presentAPPG;
    QJsonArray jsonArray_ABCDE,jsonArray_SevenState;
    QJsonArray jsonArray_VascularIndex;


    if(job.contains("jsonArray_presentAPPG") && job.value("jsonArray_presentAPPG").isArray())
    {
        jsonArray_presentAPPG=job.value("jsonArray_presentAPPG").toArray();
        int len=jsonArray_presentAPPG.size();
        for(int i=0;i<len;i++)
        {
            hi.appg.Pre_APPG.append(jsonArray_presentAPPG.at(i).toDouble());
        }

    }
    if(job.contains("jsonArray_presentPPG") && job.value("jsonArray_presentPPG").isArray())
    {
        jsonArray_presentPPG=job.value("jsonArray_presentPPG").toArray();
        int len=jsonArray_presentPPG.size();
        for(int i=0;i<len;i++)
        {
            hi.appg.Pre_PPG.append(jsonArray_presentPPG.at(i).toDouble());
        }

    }
    if(job.contains("jsonArray_SevenState") && job.value("jsonArray_SevenState").isArray())
    {
        jsonArray_SevenState=job.value("jsonArray_SevenState").toArray();
        int len=jsonArray_SevenState.size();
        for(int i=0;i<len;i++)
        {
            hi.appg.SevenState.append(jsonArray_SevenState.at(i).toDouble());
        }

    }
    if(job.contains("jsonArray_ABCDE") && job.value("jsonArray_ABCDE").isArray())
    {
        jsonArray_ABCDE=job.value("jsonArray_ABCDE").toArray();
        int len=jsonArray_ABCDE.size();
        for(int i=0;i<len;i++)
        {
            hi.appg.abcde.append(jsonArray_ABCDE.at(i).toInt());
        }

    }
    if(job.contains("jsonArray_VascularIndex") && job.value("jsonArray_VascularIndex").isArray())
    {
        jsonArray_VascularIndex=job.value("jsonArray_VascularIndex").toArray();
        hi.appg.VascularState=jsonArray_VascularIndex.at(0).toInt();
        hi.appg.DPI=jsonArray_VascularIndex.at(1).toDouble();
        hi.appg.SP=jsonArray_VascularIndex.at(2).toDouble();
        hi.appg.BVT=jsonArray_VascularIndex.at(3).toDouble();
        hi.appg.RBV=jsonArray_VascularIndex.at(4).toDouble();
        hi.appg.Age=jsonArray_VascularIndex.at(5).toInt();
        hi.appg.K=jsonArray_VascularIndex.at(6).toDouble();

    }
    if(job.contains("Vasular_res"))
        hi.appg.Vascular_res=job.value("Vasular_res").toString();
    return hi;
}
